1. What does the keyword const mean?
Const int A; int Const A; Const int *A; int Const *A; int Const A; int Const Const A;
The first two functions are the same: A is a constant integer number
The third and fourth means: A is a pointer to a constant integer number (the integer number is not modifiable, but the pointer can)
Fifth: A is a constant pointer to the number of shapes (the integer number pointed to by the pointer can be modified, but the pointer cannot be modified)
The last one means: A is a constant pointer to a constant number (the integer number pointed to by the pointer is not modifiable and the pointer is not modifiable)
2, the role of the static keyword
- The static modifier function is an intrinsic function that can only be called in this file, and other files cannot be called;
- The static modified global variable is an internal variable that can only be used in this file, and other files cannot be referenced by the extern keyword; (global variables are initialized only once, always reside in memory, and are destroyed when the program exits)
- The static modified local variable is initialized only once, and the memory is reclaimed when the program exits.
3, the role of the keyword extern
extern indicates the keyword of the function and the scope of the global variable, which tells the compiler that its declared amount function or variable can be used in this module or in other modules.
extern just declares that it needs to be initialized somewhere else.
(It can also be said that extern can refer to a global variable declared elsewhere)
- Note: This place is not clear, these three keywords of 1 and 32 keywords function after the perfect!!
20151023-const, static, extern effect