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 purpose of sprintf() function?
Explain pointer. What are function pointers in C?
How can I discover how many arguments a function was actually called with?
Explain what is wrong in this statement?
Explain what is wrong with this statement? Myname = ?robin?;
write a progrmm in c language take user interface generate table using for loop?
Write a program for Overriding.
How many types of sorting are there in c?
How do I round numbers?
Why is #define used?
What is pre-emptive data structure and explain it with example?
Why should I use standard library functions instead of writing my own?
What is a far pointer in c?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?