pointers and function calls inside a function
Hello, I have a problem I am trying to figure out. I have a variable a in main. I am passing the address of this variable to my function foo.
Code:
int main() {
int a = 0;
foo(&a);
}
void foo(int * a);
in my function foo, I would like to do the same thing to this variable within my function foo, passing it to my function foo2.
Code:
void foo(int * a) {
foo2(&(*a));
}
void foo2(int * a) {
int x = *a;
}
would that be a proper call, parameter list and use of the variable in my function? thank you.