Hey all. I'm working on a project for school where I need to pass a few parameters by reference through multiple functions. I understand how I can pass by reference from where the variables are declared to another function, like this:
main() {
int x = 0;
int y = 0;
int z = 0;
foo_function(&x, &y, &z);
}
int foo_function(int* x, int* y, int* z) {
*x = *y * *z;
return 0;
}
However, how would I pass x, y, and z from foo function to another function? Something like this gives me all kinds of compiler warnings.
int foo_function(int* x, int* y, int* z) {
*x = *y * *z;
bar(&x, &y, &z);
return 0;
}
int bar(int* x, int* y, int* z) {
//some stuff
}