What are Storage Classes in C ?

Answer Posted / vagish

storage class contains five types of storage class in c .
I. Extern
II. Static
III. Register
IV. Auto
V. typedef
I. Auto - This is the default storage class. Auto can only
be used with in functions. i.e. only for local variables,
not for globals.
II. 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.
III. 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.
IV. 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.
V. Typedef- A typedef declaration lets you define your own
identifiers that can be used in place of type specifiers
such as int, float, and double. A typedef declaration does
not reserve storage. The names you define using typedef are
not new data types, but synonyms for the data types or
combinations of data types they represent.

Is This Answer Correct ?    23 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to compare array with pointer in c?

610


What are the valid places to have keyword “break”?

642


What does printf does?

729


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

554


How do you override a defined macro?

688






Why doesnt the call scanf work?

652


What is New modifiers?

655


What is assert and when would I use it?

568


What does %2f mean in c?

668


what is the significance of static storage class specifier?

1650


Explain what is wrong with this program statement? Void = 10;

754


Write a program to know whether the input number is an armstrong number.

660


Does free set pointer to null?

545


How do you print only part of a string?

602


What is n in c?

564