Home > Article > Backend Development > What is the default storage class of formal parameters in C language?
The default storage class of formal parameters in the C language is auto; when the formal parameter uses the keyword auto to declare the storage class, the keyword "auto" can be omitted. If auto is not written, it is implicitly determined to be "automatic" Storage class", which belongs to the dynamic storage method.
#The operating environment of this article: Windows 7 system, C11, Dell G3 computer.
What is the default storage class of formal parameters in C language?
The default storage class of formal parameters in the C language is auto. When the program is compiled, no storage space is allocated for formal parameters. Only when called, formal parameters temporarily occupy storage space.
When the formal parameter uses the keyword auto to declare the storage class, the keyword "auto" can be omitted. If auto is not written, it is implicitly determined to be the "automatic storage class", which belongs to the dynamic storage method.
Extended information
1. The type of formal parameters cannot be omitted. The storage type of a function is the storage type before the data type in front of the function name when the function is defined. The default should be: extern, which means that the function is an external function (that is, it can be used by functions in other C source program files other than this C file. transfer).
2. For custom functions, default parameters can be used to achieve a certain degree of "overloading" and other functions. Default parameters can only be placed in the function declaration because the compiler must know it before use. Default value. The parameters at the end of the function parameter list can be defaulted. After the default parameter value is used at a certain position, it will be the default parameter value.
Recommended study: "c Language Tutorial"
The above is the detailed content of What is the default storage class of formal parameters in C language?. For more information, please follow other related articles on the PHP Chinese website!