What are Storage Classes in C ?
Answer Posted / monika
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 ? | 31 Yes | 4 No |
Post New Answer View All Answers
What is structure in c language?
What is the most efficient way to count the number of bits which are set in an integer?
Is stack a keyword in c?
What is variable initialization and why is it important?
What are the complete rules for header file searching?
What is struct node in c?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Write a program to swap two numbers without using third variable?
Why doesnt the call scanf work?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
What does it mean when the linker says that _end is undefined?
Explain the difference between strcpy() and memcpy() function?
What is array of structure in c?
Explain how can I read and write comma-delimited text?
i want to know the procedure of qualcomm for getting a job through offcampus