int x;
int * px = & ampx; //Assign value when defining, also called initialization. Note that the * here follows the int, that is, the variable px is an int * type variable! The actual assignment statement is px = &;; x;
int * py
py = & ampx; //Assign a value separately, and point py to x.
* py = 10; //The * here refers to the data operator in the pointer, and the variable followed by * must be a pointer type variable, otherwise an error will occur! *py is x, which is equivalent to x =10;
2. When the pointer variable is used as the parameter of the function, the sub-function can modify the data in the actual parameter address by referring to the data in the actual parameter address through the pointer. For example:
# include & ltstdio.h & gt
void func( int a,int b,int *pmax)
{
If (a & gtb)* pmax = a;;
else * pmax = b;
}
void main()
{
int a=2,b=3,max = 0;
func(a,b,& ampmax); //Here, the address of the variable max is passed to the sub-function, and the value of max can be modified through this address in the sub-function, so that max can bring back the operation result after the sub-function.
printf("max=%d\n ",max);
}