C 中的 auto、static、register 和 extern 的区别
The difference between auto, static, register, and extern in C
Each variable annd B or 0?. So the program outputs 7, 8, 9.
Static can also declare functions, eg:static, int, fun (int, a, int, b), called fun as internal functions, or static functions. The use of an internal function is limited to the file in it, and the internal functions of the same name in each file do not interfere with each other.
Register variables: general variable values are stored in memory, (when the program needs to be used where the value of a variable, the controller sends out the instruction to the variable memory value to the operation is finished if you need to deposit, then the data is sent to the memory storage. From the computing device) So it leads to a problem, if we are a frequent operation, the stored variables must spend a lot of time, so the C language allows the local variable values stored in registers, so when you need to move directly, do not need to have memory. Increase computing speed.
Extern declares external variables: external variables (i. e. global variables) are defined outside of the function.
The scope starts with the definition of the variable and ends at the end of the program file. You can declare external variables in a file, such as:
Main ()
Extern, A, B:
Printf ("%d”, "Max” (A, B));
) int, A=13, B=-8:
You can also decl
C中的auto、static、register和extern的区别 来自淘豆网www.taodocs.com转载请标明出处.