What are Storage Classes in C ?

Answers were Sorted based on User's Feedback



What are Storage Classes in C ?..

Answer / 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

What are Storage Classes in C ?..

Answer / vijoeyz

C has three types of storage: automatic, static and
allocated.

Variable having block scope and without static specifier
have automatic storage duration.

Variables with block scope, and with static specifier have
static scope. Global variables (i.e, file scope) with or
without the the static specifier also have static scope.

Memory obtained from calls to malloc(), alloc() or realloc()
belongs to allocated storage class.

--
http://www.geocities.com/vijoeyz/faq/



Is This Answer Correct ?    27 Yes 282 No

Post New Answer

More C Interview Questions

Why c is called a mid level programming language?

0 Answers  


What is the significance of scope resolution operator?

0 Answers   Agilent, ZS Associates,


Why does notstrcat(string, "!");Work?

0 Answers  


5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.

0 Answers  


Do you have any idea how to compare array with pointer in c?

0 Answers  






Go through this linked list concept.While traversing through the singly linked list sometimes the following code snippet "while(head != NULL)" is used and other times "while(head->link != NULL)"is used(Here head is the pointer pointing to the first node,node has two parts data part and link part).What is the difference between head != NULL and Head->link != NULL and in which situation are they used?

1 Answers   Oracle,


Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa.

1 Answers  


What is the use of the function in c?

0 Answers  


Do you know what is a programing language ?

0 Answers  


Why void main is used in c?

0 Answers  


What does %p mean?

0 Answers  


1 232 34543 4567654 can anyone tell me how to slove this c question

6 Answers  


Categories