Home > Back-end >  Pointer to the variable
Pointer to the variable

Time:06-08

Pointer variable as void functions in the form of parameters, if the pointer variable points to the value of a variable changes, can be back to the main function, but if the value of the pointer variable change cannot back to the main function, what reason is this

CodePudding user response:

Not back, can't modify the parameter in the function in the programming language, but can pass parameters, indirect addressing, change its address, the content of pointer as a function parameter, is the address of a variable into come in, can pass the address in the function, addressing, and then modify the content, you can't modify, may be because you want to modify a pointer, for example, if you want to modify the int type, so should be introduced to type int * and if you want to modify the int * type, then you should be introduced to int * * type

CodePudding user response:

Don't know if this meaning:
 
Void fun (int * a) {
* a=1;//this change
A=1;//not
}

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related