3. pointer
1. The memory address is a serial number. These serial numbers are consecutive and are called addresses. The memory size corresponding to the serial number is measured in bytes. 2. the size of the memory address is related to the number of bits in the data bus. memory Access is divided into direct access and indirect access ① direct access: Example of direct access to the content in the memory unit: int a = 20; for direct access, a represents the memory unit that stores data, by assigning values or values to a, you can access the memory. ② indirect access: access the data in the memory through the memory unit number (address) and the number of bytes occupied by the data can be seen everywhere in the program, indirect memory access through pointers 4. pointer: address. Memory Address. We often call the memory address a pointer. 5. Address: Memory number. The memory address can be abbreviated as the address. "&" To view the memory address of a variable. "% P" Print address 6. key Symbol: "&" Get address character 7. pointer variable: the variable that stores the memory address 8. define the pointer variable: You need to add * at this time * to indicate the function, and tell the compiler p a variable that stores the address. p is a pointer variable example: int a = 20; int * p = & a; // (int *) p = & a; 9. example of the content corresponding to the * Access Memory number using the * Symbol: int a = 5; // defines an integer int * p = NULL; // defines a pointer variable, the address is blank. p = & a; // obtain the address printf ("% d", * p) of a; // * p gets the content 10 in. assign a value to the pointer variable, which means that the Pointer Points again to 11. pointer type: ① because the memory address is only related to the operating system, the memory occupied by the pointer variable depends on the number of BITs (32-bit system pointer occupies 4 bytes, example: int * p = NULL; double * p1 = NULL; float * p2 = NULL; Long * p3 = NULL; char * p4 = NULL; printf ("% lu \ n", sizeof (p )); // eight bytes printf ("% lu \ n", sizeof (p1); // eight bytes printf ("% lu \ n", sizeof (p2 )); // eight bytes printf ("% lu \ n", sizeof (p3); // eight bytes printf ("% lu \ n", sizeof (p4 )); // 8 bytes. As long as the address is used, it is 8 bytes. The number of address bytes has nothing to do with the data type. The data type control starts from where and how many bytes are taken. ② Int * p integer pointer double * p double Precision pointer char * p character pointer ③ different types of pointers, access memory size is different 12. memory usage ① manual application (malloc function) ② system allocation (the memory space defined for variables is allocated by the System) 13. the pointer variable adds or subtracted a constant, and the pointer itself does not move 14. the pointer variable is auto-incrementing, the pointer moves, and the address changes. 15. The pointer type must be consistent with the data type pointing to the memory. 16. Complement: ① The symbol bit remains unchanged ② the other bits take the inverse ③ the last bits add 117. The array name is a symbolic address constant, not a variable, so it cannot be auto-incrementing or auto-subtracted