void double_trouble(int *p, int y);
void trouble(int *x, int *y);
int
main(void)
{
int x, y;
trouble(&x, &y);
printf("x = %d, y = %d\n", x, y);
return (0);
}
void
double_trouble(int *p, int y)
{
int x;
x = 10;
*p = 2 * x - y;
}
void
trouble(int *x, int *y)
{
double_trouble(x, 7);
double_trouble(y, *x);
}
For the code above, I know the output of x
and y
should be 13 and 7.
However I'm a little confused that since it's in void, why would the value
still stored in the x
and y
? In other words, since
double_trouble(x, 7);
is called, why the value of x
still 13? I mean it's void, the stored value will be deleted, won't it?
If my question is not very clear, please explain a little of function call in the
void trouble(int *, int *)