This is a simplified example of the problem I have:
#include <stdio.h>
#include <stdlib.h>
void f2(int** a) {
printf("a: %i\n", **a);
}
void f1(int* a) {
f2(&a);
}
int main() {
int a = 3;
f1(&a); // prints "a: 3"
f2(???);
return 0;
}
The problem is that I would like to be able to use f2()
both in main()
and in f1()
.
Can that be done without using global variables?