For the & operator in C, the Baidu Encyclopedia is defined as: (&P) is an operation that returns the address opened at the time when P was declared, but according to my observations on the code, I think the & operator is not just the function of returning the address;
For example:
int a = 1;
Suppose the address of a is 0x7dfe88
int *p = (int *) 0x7dfe88;
int num = 1;
int *P1 = #
The above is a simple code to the pointer p,p1 assignment, 0X7DFE88 is a simple hexadecimal address, but when the address to the pointer must be accompanied by a strong (int *), if not enhanced, then the compiler will warn (warning C4047: "Initialization": "Int * "int" is different from the indirect level), but using the & operator does not need to add any strong turn to compile through, the & operator is never to get the address so simple, the "=" assignment operator is right-to-left, stating "=" to the right is also a pointer, So this assumes that the & operator takes out the address of NUM and generates a temporary pointer based on the type of Num.
Based on assumptions, write the following code validation:
int num = 1;
Double *P1 = #
Result compiler reported "warning C4133:" Initialization: "int *" to "double *" type incompatible "error. So my hypothesis has a certain truth.
Sum up:
(&P) is an operation that returns a pointer to the address that was opened at the time when P was declared, and the type of the pointer is the pointer type for the type of p. (Just my own opinion)
Understanding of C-language & address-taking operators