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
Write a program to identify if a given binary tree is balanced or not.
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
What is pointers in c with example?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
Which is the best website to learn c programming?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What are void pointers in c?
What's a good way to check for "close enough" floating-point equality?
What is keyword with example?
How can I access an I o board directly?
What are the disadvantages of c language?
What is the stack in c?
find the sum of two matrices and WAP for it.
Explain which function in c can be used to append a string to another string?
Explain what is the best way to comment out a section of code that contains comments?