Based on the role of keywords, keywords can be divided into two categories: data type keywords and process control keywords.
1 Data type keyword
A basic data type (5)
void: declares a function with no return value or no parameters, declares an untyped pointer, Explicitly discard the operation result
char: character type data, a type of integer data
int: integer data, usually the machine word length specified by the compiler
p>
float: single-precision floating-point data, a type of floating-point data
double: double-precision floating-point data, a type of floating-point data
B type modification keywords (4)
short: Modifies int, short integer data, the modified int can be omitted.
long: modified int, long integer data, the modified int can be omitted.
signed: modified integer data, signed data type
unsigned: modified integer data, unsigned data type
C complex type keyword (5 )
struct: structure declaration
union: ***body declaration
enum: enumeration declaration
typedef: Declare type alias
sizeof: Get the size of a specific type or variable of a specific type
D storage level keyword (6)
auto: Specify as an automatic variable , automatically allocated and released by the compiler. Usually allocated on the stack
static: designated as a static variable, allocated in the static variable area. When modifying a function, specify the function scope to be inside the file
register: designated as a register variable, It is recommended that the compiler stores variables in registers for use, and can also modify function parameters. It is recommended that the compiler transfer parameters through registers instead of stacks
extern: Specify the corresponding variables as external variables, that is, in another target file Defined in, it can be considered as a "reference" to an object declared by another file
const: Together with volatile, it is called the "cv characteristic". The specified variable cannot be changed by the current thread/process (but it may be System or other threads/process changes)
Volatile: Together with const, it is called "cv feature". The value of the specified variable may be changed by the system or other processes/threads, forcing the compiler to read it from memory each time. Get the value of the variable
2 Process control keywords
A jump structure (4)
return: used in the function body to return a specific value (or void value, that is, no value is returned)
continue: end the current loop and start the next cycle
break: jump out of the current loop or switch structure
goto: unconditional jump statement
B branch structure (5)
if: conditional statement
else: conditional statement negates the branch (used with if)
switch: switch statement (multiple branch statements)
case: branch mark in the switch statement
default: "other" divide and conquer in the switch statement, Optional.
C loop structure (3)
for: for loop structure, the execution order of for(1;2;3)4; is 1->2->4-> 3->2... loop, where 2 is the loop condition
do: do loop structure, the execution sequence of do 1 while(2); is 1->2->1... loop, 2 is the loop condition
while: while loop structure, the execution sequence of while(1) 2; is 1->2->1... loop, 1 is the loop condition
In the above loop statement, when the loop conditional expression is true, the loop will continue, and if it is false, it will jump out of the loop.