What are Storage Classes in C ?
Answer Posted / vijayalakshmi
There are four types of storage classes in c. It defines the
scope and lifetime of a variable or function.
1. auto - This is the default storage class. Auto can only
be used with in functions. i.e. only for local variables,
not for globals.
2. register - The variables declared using the register
storage class may stored in cpu registers instead of RAM.
Since it doesn't have a memory location, the '&' operator
for getting the address of the variable cannot be applied
(in C). This storage class cannot be used for global scope data.
3. static - This is the default storage class for global
variables. In case of local variable, it is initialized at
compile time and retains its value between the calls. By
default the static variables will be initialized to zero,
incase of pointer variable initialized to NULL.
4. extern - Defines the global variables that is visible to
all object modules. This type of variables cannot be
initialized, since it is pointing to a storage location,
where it is previously define.
| Is This Answer Correct ? | 12 Yes | 2 No |
Post New Answer View All Answers
What is the function of multilevel pointer in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
how should functions be apportioned among source files?
What is enumerated data type in c?
What is the difference between procedural and functional programming?
What are the characteristics of arrays in c?
Why structure is used in c?
How can you find out how much memory is available?
Is that possible to add pointers to each other?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
Explain the use of 'auto' keyword
What are the three constants used in c?
How many bytes is a struct in c?