After the Declaration and operation of pointers in the previous article, this article describes several common and important pointer concepts.
I. pointer constants and constant pointers
These two concepts also exist as follows. Like two connected words, the first word is a modifier, and the latter is a central word.
Constant pointer, which is a pointer to a constant. A constant Pointer Points to a constant to prevent the update of a constant from incorrect operations on the pointer. The content of the address pointed to by the pointer cannot be modified. A pointer constant is a constant first, and then a pointer. A pointer constant cannot modify the address to which the Pointer Points. Once Initialization is complete, the address to which the Pointer Points is fixed and cannot be moved.
2. pointer array and array pointer
These are two different concepts. Pointer array, that is, the elements of the array are pointer-formed; array pointer, that is, pointingArray pointer.
Iii. function pointers and pointer Functions
These are two confusing concepts, especially when they appear together.
A pointer function is a function with a pointer. It is essentially a function and returns a pointer of a certain type. It is defined as follows:
Return type identifier * return name (form parameter table) {function body}
In fact, every function has an entry address even if it does not contain a pointer of the return type, which is equivalent to a pointer pointing to the return value address. This pointer is equivalent to the function itself, that is, the entire function is equivalent to a "variable ".
A function pointer is a pointer variable pointing to a function. Therefore, it is a pointer variable first, except that the pointer variable points to a function. With the pointer variable pointing to the function, you can call the function just as the pointer variable references other types of variables.
4. Wild pointer
A wild pointer generally refers to a pointer that is not well controlled by the Code. When a pointer is defined in the program and the pointer is not directed to a specific address, the pointer will point to an address at will. Such a pointer is a wild pointer. If there is no important data in the memory space behind this address, it will not cause serious consequences. However, once useful data is stored in the address, the data may be accessed by wild pointers at any time, in this case, the data is damaged. Therefore, the existence of a wild pointer should be prohibited in the program.