c++ static function, variable

static global variable

Global variables themselves are static storage methods, and static global variables are of course also static storage methods. The two are no different in how they are stored. The difference between the two is that the scope of non-static global variables is the entire source program. When a source program consists of multiple source files, non-static global variables are valid in each source file. The static global variable limits its scope, that is, it is only valid in the source file where the variable is defined, and cannot be used in other source files of the same source program.

Static function (internal function)

Indicates that the scope of the function is limited to this file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325604254&siteId=291194637