Home > Back-end >  About the function call parameters can't send values to the arguments.
About the function call parameters can't send values to the arguments.

Time:12-19

Since parameter can't pass argument, the value of the return, please what is the value passed to?

CodePudding user response:

Parameter is actually another variable, when you put the arguments passed to the parameter of time, is to put the argument assigned to formal parameters, the parameters were changed, how can the corresponding argument? Is clearly impossible, the function return value is done by CPU registers, returned after the register assigned to another variable, will change the value of this variable

CodePudding user response:

Parameter is equal to the function of the local variable, before all explicitly define local variables (in the address, if you typed the address, will find that they are next to the local variables), all parameter to copy the value of the argument, only the pointer can refer to another memory location, so as to realize the value of modified reference variables

CodePudding user response:

Functional, in the () and {}, effect is the same, only foreign attribute is different,
So to speak, is the value of your argument is assigned to the parameter, you want to change the argument in other places, you can pass the value of the pointer to modify the argument indirectly,
Your argument memory block is not change, variable parameter is a new type, memory blocks,

CodePudding user response:

Typo, new memory block

CodePudding user response:

Parameter value is not to argument is designed by C language, not because it have what technical barriers,
Like someone not steal because conscience and the law does not allow, but not because of stealing it technical threshold is too high,

CodePudding user response:

Create a temporary variables, copies of the past
  • Related