Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What are the 37 keywords of C language?
What are the 37 keywords of C language?
Keywords are words that have been used by C language itself and cannot be used for other purposes. For example, keywords cannot be used as variable names, function names, and so on.

There are 32 keywords * * * in C language defined by ANSI standard:

Automatic double int structure interrupt else long switch

Case enumeration register typedef char extern returns union.

const float short unsigned continue for signed void

Default goto sizeof static time variable do if

According to the function of keywords, keywords can be divided into two categories: data type keywords and process control keywords.

1 data type keyword

A. Basic data types (5)

Void: Declare that the function has no return value or no parameters, declare that there is no type pointer, and explicitly discard the operation result.

Char: data of character type, which is an integer data.

Int: Integer data, usually the machine word length specified by the compiler.

Float: Single-precision floating-point data, which belongs to a kind of floating-point data.

Double: double-precision floating-point data, which belongs to a kind of floating-point data.

B. Type modifier keyword (4)

Short: decorated int, short integer data, decorated int can be omitted.

Long: decorated int, long integer data, decorated int can be omitted.

Signed: modifies integer data and has a signed data type.

Unsigned: decorated integer data, unsigned data type.

C. Complex type keywords (5)

Structure: structure declaration

Joint: * * Declared in the aspect.

Enumeration: Enumeration declaration

Typedef: declare type alias

Sizeof: Get the size of a specific type or variable of a specific type.

D. storage level keywords (6)

Auto: designated as an automatic variable, which is automatically allocated and released by the compiler. Usually allocated on the stack.

Static: designated as a static variable, distributed in the static variable area. When decorating a function, the scope of the function is specified as inside the file.

Register: Specify as a register variable. It is suggested that the compiler store variables in registers for use or modify function parameters. It is recommended that the compiler pass parameters through registers instead of the stack.

Extern: specifies the corresponding variable as an external variable, which means that the definition of the variable or function is in another file. When encountering the variable and function, the compiler is prompted to look for its definition in other modules.

Const: collectively referred to as "cv feature" with volatile, the specified variable cannot be changed by the current thread/process (but can be changed by the system or other threads/processes).

Volatile: collectively referred to as "cv feature" with const, the value of the specified variable may be changed by the system or other processes/threads, forcing the compiler to get the value of the variable from memory every time.

2 process control keywords

A. Jump structure (4 pieces)

Return: used in the function body to return a specific value (or void value, that is, no return value).

Continue: End the current cycle and start the next cycle.

Break: jump out of the current cycle or switch structure

Goto: unconditional jump statement

B. Branch structure (5)

If: conditional statement, without semicolon.

Else: Negative branch of conditional statement (used with if)

Switch: switch statement (multi-branch statement)

Case: branch tag in switch statement

Default value: the optional "Other" branch in the switch statement.

C. circular structure (3)

For: For circular structure, for (1; 2; 3)4; The execution order of is1-> 2->; 4->; 3->; 2 ... cycle, where 2 is the cycle condition. Throughout the for loop, the expression 1 is evaluated only once, while expressions 2 and 3 may be evaluated multiple times or not at all. The loop body can be executed many times or not at all.

Do: Do loop structure, do1while (2); The execution order of is1->; 2->; 1 ... loop, and 2 is the loop condition.

While :while loop structure, while (1) 2; The execution order of is1->; 2->; 1 ... cycle, 1 is the cycle condition.

In the above loop statement, if the loop condition expression is true, continue the loop, if false, jump out of the loop.

1999 16 February 16, ISO introduced the C99 standard and added five C language keywords:

Inline restrict _ bool _ complex _ imaginary