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 are the benefits of c language?
What do you understand by friend-functions? How are they used?
Explain what is the difference between null and nul?
Why c is a mother language?
What is the purpose of & in scanf?
What is the main difference between calloc () and malloc ()?
What language is windows 1.0 written?
write a program to create a sparse matrix using dynamic memory allocation.
How does pointer work in c?
Explain how do you sort filenames in a directory?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Explain is it valid to address one element beyond the end of an array?
Define C in your own Language.
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is the difference between abs() and fabs() functions?