1) pointer is a variable, is used to store the address of the variable, occupy memory space, used to save memory address;
2) When the pointer is declared, the * number indicates that the variable being declared is a pointer
When the pointer is in use, the * number represents the value in the memory space pointed to by the operation pointer;
*p equivalent to find a piece of memory through the address, and then manipulate the memory;
*p placed on the left side of the equal sign (assigning values to memory);
*p is placed on the right side of the equal sign (from memory to get the value);
3) The pointer variable and the memory block it points to are two different concepts
Meaning 1: assigning p to p=0x1111; only changes the value of the pointer variable, does not change the point of the content;
Meaning 2: Assigns a value *p= ' a ' to *p, does not change the value of the pointer variable, only changes the value of the memory block pointed to;
Meaning 3: The left side of the equals sign *p for memory assignment; the right side of the equals sign *p the value;
4) A pointer is a data type that refers to the data type of its memory space
Meaning 1: Pointer step size (p++), determined according to the data type of the memory space pointed to
C Language provision: To free memory must be released from the first memory address
A pointer variable and the memory space it points to are two different concepts
1 char *p = NULL; 2 p = (char *)malloc(+); 3 4 if (!p = = NULL) 5 {6 Free (p); 7 p = NULL; 8 }
Free (p) is the content of the memory space that P points to, and the value in the pointer variable p is still present, and P is required to be pointed to null to prevent the wild pointer from being generated
The "C language" pointer is a variable