Does a function have any storage class in C Language?
auto: This is the default storage class for all the variables declared inside a function or a block. Hence, the keyword auto is rarely used while writing programs in C language. Auto variables can be only accessed within the block/function they have been declared and not outside them (which defines their scope).
Which of the following is not a storage class specifier in C? Explanation: volatile is not a storage class specifier.
You can use either the static or the extern storage-class specifier in function declarations. Functions always have global lifetimes. Function declarations at the internal level have the same meaning as function declarations at the external level.
The answer is no. According to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf (draft of C99) and http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf (draft of C11):
6.2.4 Storage durations of objects
1 An object has a storage duration that determines its lifetime.
Functions aren't objects, so they have no storage.
6.2.2 Linkages of identifiers
3 If the declaration of a file scope identifier for an object or a function contains the storage-class specifier
static
, the identifier has internal linkage.
This says that static
applied to a function affects its linkage (there is no storage it could apply to).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With