Hi. I'm sure this has been asked before, but I couldn't find an answer, so I'll just ask again:
I have two separate modules:
Code:
mod1.c
f2(int *value) {
g1(value);
}
f1() {
int value;
f2(&value);
}
mod2.c
g1(int *value) {
if(something) *value--;
}
If I printf *value in g1, it decrements correctly. However, when g1 returns to f1, value remains unchanged.
I'm just not seeing it at the moment what I'm missing, so I'm about to 'give up' and just use "extern int value;" in mod2, its just that I'd like to get this working by 'reference'.
Any help much appreciated