In the case of C language, when we want to pass a variable by reference we need to pass the address of the function to the function, I have a question in this case.
See the example:
int main(){
int *a;
*a = 5;
foo(&a);
}
void foo(int **a){
//tenho que passar o endereço para garantir a mudança?
bar(&a);
}
void bar(int ***a){
//como atribuir? ***a = 1; ??
}
My question is as follows, if I want to pass a reference to a pointer to a variable, is it always necessary to pass the address of what I have in the scope of the function to ensure that the result is changed?
If yes, how do I assign the value when I have **a
or ***a
?
Is there another approach? How to facilitate this control?