Exercise 1

Course notes for ESC190 Computer Algorithms and Data Structures

Exercise 1

Write a function which changes the value of a:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
void change_a(...)
{
  ...
}

int main()
{
  int a;
  change_a(...);
  printf("The value of a is %d", a);
  return 0;
}

Write a function which does NOT change the value of a:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
void dont_change_a(...)
{
  ...
}

int main()
{
  int a;
  dont_change_a(...);
  printf("The value of a is %d", a);
  return 0;
}