Question: I am trying to update a variable using two different functions. I wrote a little C program to demonstrate:

```
#include <stdlib.h>
#include <stdio.h>

void updateHelper(int *x, int y) {
    *x = y;
}

void update(int x, int y) {
    updateHelper(&x, y);
}

int main(int argc, char *argv[]) {

    int num = 0;
    update(num, 1);
    printf("%d\n", num);

    return 0;
}

```

Why is this printing a 0 and not a 1? I can't wrap my head around this. The function that is actually updating the value is indeed passed a reference of the variable(!?). Can someone explain why this happens? 

The arguments of update() can not be pointers. Are there any possible work-arounds for this?

Answer: 
You aren't updating the original variable. You're updating the *copy* of that variable that was passed to your `update` function. If you want to update the original variable, change `update` to take it's parameter as a pointer:

```
void update(int* x, int y) {
    updateHelper(x, y);
}

```

and in main, pass the address:

```
update(&num, 1);

```

Edit: since you stated the arguments to update cannot be pointers, you will need to either have `update` return the new variable, or use a global variable, or ... In C, the only way to modify a reference to a variable in a function is by using pointers.
```
update(int x,..)

```

int x here is a argument by value. ie a copy (new address created) of num is created and the value is copied.

try instead:

```
#include <stdlib.h>
#include <stdio.h>

void updateHelper(int *x, int y) {
    *x = y;
}

void update(int *x, int y) {
    updateHelper(x, y);
}

int main(int argc, char *argv[]) {

    int num = 0;
    update(&num, 1);
    printf("%d\n", num);

    return 0;
}

```