What are Storage Classes in C ?

Answer Posted / babu

There are two storage classes : Automatic and Static.

Automatic objects are local to block,and are discarded on
exit from the block.Declaration with in a block create
automatic objects if no storage class spections is
mentioned , or if the auto specifier is used.Object
declared as register are automatic,and are (if Possible)
stored in fast registers of the machine.

Static obj may be local to a block or external to all
blocks,but in either case retain their values across exit
from and reentry to function and blocks.Within a block
including a block that provides the code for a function,
static objects are declared with the keyword Static.
The objects declared outside all blocks,at the same level
as function definitions,are always static keyword;this
gives them Internal Linkage.
They become global to an entire program by omitting an
explicit storage class ,or by using keyword Extern;this
gives external linkage.

Is This Answer Correct ?    44 Yes 166 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the use of keyword 'register' with respect to variables.

587


Explain a pre-processor and its advantages.

624


Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record

4737


Explain what is a 'locale'?

581


Difference between pass by reference and pass by value?

656






What is far pointer in c?

805


What is a good data structure to use for storing lines of text?

591


What are 'near' and 'far' pointers?

616


Give basis knowledge of web designing ...

1569


Do pointers store the address of value or the actual value of a variable?

606


How do you sort filenames in a directory?

708


What is c variable?

548


How do I convert a string to all upper or lower case?

624


What is scope rule of function in c?

545


Are there namespaces in c?

565