CodePudding user response:
Someone I'm dizzyCodePudding user response:
See default is static before was not so sureCodePudding user response:
Global variables by default and static and extern is different,So there was no global variables default storage categories,
CodePudding user response:
The global position of theInt a; Allocate space to establish a global variable is initialized to zero, and generously allowed other files to use this variable,
Static int a; Allocate space to establish a global variable is initialized to zero, and other file sharing this variable,
Extern int a; This appeared in the "other files", does not allocate space to establish variable, but the first line of the above variables is introduced into this file to play a role,
CodePudding user response:
Global variables are global variables, the modifier extern use before the variable or function of the statement, used to indicate "this variable/function is defined elsewhere, to quote here" other extern file can be used to refer to the same variable, the static means static storage, at the beginning that the file is available, used in the code block can only be visible in the code block, and the block of code is the variable difference between stack, stack variables declared in a clearing, such as the while int variable declarations within a cycle can be recreated, and the static variable values, and will not eliminate, recreating, program exists static variables,CodePudding user response: