1. Basic Concepts of keywords
- Words that are given special meaning by C language
A, keyword feature : all lowercase
b, keywords in development will show a special color
The compiler is strictly case-sensitive
The. Keyword cannot be used as a variable name, function name, and so on.
- A total of 32 keywords in C language
Auto Doble int struct break else long switch case enum register typedef char extern return Union const float Short U Nsigned continue for signed void default goto sizeof volatile does if while static comment: These are not for the time being deliberately written down, later will learn slowly. According to the role of keywords, you can divide the keywords into data type keywords and process Control keywords two categories.
1 Data type keywords
A basic data type (5)
void: Declares a function with no return value or no argument, declares an untyped pointer, and explicitly discards the result of the operation
Char: Character type data, which is an integral type of data
int: integer data, usually the machine word length specified by the compiler
FLOAT: single-precision floating-point data, a type of floating-point data
Double: dual-precision floating-point data, which is a type of floating-point data
Type B modifier keywords (4)
Short: Modifies int, shorter integer data, can omit the modified int.
Long: Modifies int, length shaping data, can omit the modified int.
Signed: Modifying integer data, signed data type
Unsigned: Modifying integer data, unsigned data type
C Complex Type keywords (5)
struct: struct declaration
Union: Common Body Declaration
Enum: enum declaration
typedef: Declaring type aliases
sizeof: Getting the size of a particular type or variable of a particular type
D Storage-level keywords (6)
Auto: Specified as an automatic variable, automatically allocated and freed by the compiler. Usually allocated on the stack
Static: Specifies that the function is scoped to the file when it is assigned the static variable, and when the function is modified
Register: Specified as a register variable, it is recommended that the compiler either store the variable in the Register or modify the function parameter, suggesting that the compiler pass the parameter through the register instead of the stack
extern: Specifies that the corresponding variable is an external variable, that is defined in another target file, which can be considered as a convention by another file declaration of rhyme eel with gong rake them?
Const: With volatile collectively "CV attribute", specified variable cannot be changed by current thread/process (but may be changed by system or other thread/process)
Volatile: With the const collectively referred to as "CV attribute", the value of the specified variable may be changed by the system or other process/thread, forcing the compiler to get the value of the variable from memory every time
2 Process Control keywords
A jump Structure (4)
Return: Used in the body of a function to return a specific value (or void value, i.e. no return value)
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 Negation branch (with IF)
Switch: Toggle statement (Multi-branch statement)
Case: Branch marks in a switch statement
Default: The "other" partition in the switch statement is optional.
C Cycle structure (3)
FOR:FOR loop structure, for (1;2;3) 4, order of execution for 1->2->4->3->2 ... loop, where 2 is a loop condition
DO:DO loop structure, do 1 while (2); The order of execution is 1->2->1 ... loop, 2 is the loop condition
While:while loop structure, while (1) 2; The order of execution is 1->2->1 ... loop, 1 is the loop condition
The above loop statement, when the loop condition expression is true to continue the loop, false then jump out of the loop.
C language Keywords