Local variables
The local variables in the function have common local variables and two kinds of local static variables .
A normal local variable is a variable that is normally defined inside a function body, and if the address of a local variable is returned so that it continues to be accessed after the function call ends, the compiler will report warning itself, which is also wrong because the memory of the variable will be freed after the function call ends.
A local static variable is assigned an initial value at the time of the first definition, and the value in the subsequent call remains the same.
For example
int print () {
static int a = 1;
printf ("%d\n", a++);
}
Parameter passing
The following rules are summed up
1. If it is a normal parameter, the rule is equal to the assigned value.
2. If it's a quote,
(1) The normal reference parameter must satisfy the matching principle, for example, if the formal parameter is an int, then the pass argument can only be int, not double or const int.
(2) A constant reference parameter can pass all the parameters of a very good match, and it can pass all the const type's matching parameters (such as the value of an expression, the return result of the function, etc.).
3. Pointer reference
(1) The difference between normal pointer and regular pointer transfer is only
The function basis of HLW's C + + learning notes