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

What is structure and union in c?

581


How can I find the modification date of a file?

689


What is the benefit of using an enum rather than a #define constant?

643


How are portions of a program disabled in demo versions?

733


Can we increase size of array in c?

523






What is the use of #include in c?

566


Explain what is the difference between functions abs() and fabs()?

608


What is meant by type specifiers?

647


What is a void * in c?

581


How is = symbol different from == symbol in c programming?

595


What is a struct c#?

590


Explain the difference between #include "..." And #include <...> In c?

610


Is c procedural or object oriented?

561


Why does this code crash?

602


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

646