I. Variable declaration format:
Storage Type modifier data type variable name; 2. function declaration format: storage type return type function name (parameter list) {} Storage types: 1. Auto : Only the storage type of [variable] can be identified. Identifies the local variable stored in the running process [stack region]. Note: If a local variable is directly involved in calculation without initialization, the system will assign a random value to it. Extern : Identifies both variables and functions. For variables, extern is used to declare the global variables referenced (used) in the current file and defined in other files in the current project. Only allocate memory space once. If the global variable is not initialized, the initial value 0 is automatically assigned to it during compilation. there are two ways to use it: (1): The global variable is defined in the header file, you need to use the variable file to include the corresponding header file. Then, use the global variable directly in the source file. (2) If the global variable is defined in another file (*. c), use the extern declaration in the current file (the source file that references the global variable. For a function, extern only identifies the function scope. The default storage method is extern. In other words, if a function's storage type is not declared in a project, the function can be referenced by all files in the current project. 3. Register : It can only be used to identify variables, and the types of variables can only be integer and complex. This keyword is mainly used to identify variables that are used for a long time. If you declare a variable as register, it is recommended that the compiler resident its variable in the CPU register. Uninitialized register variables are randomly assigned a value. 4. Static : Static. Variables or functions can be identified. Declared static variables (global variables or local variables) are stored in the data zone, and their life cycle is the entire Program Runtime. If it is a static local variable, its scope is inside a pair of {}; if it is a static global variable, its scope is the current file. If the static variable is not initialized, it will be automatically initialized to 0. The static variable will only be initialized once. 5. String constant: it is stored in the data zone and its life cycle is the entire program running period. Char * A = "Hello world! ";