What are Storage Classes in C ?

Answers were Sorted based on User's Feedback



What are Storage Classes in C ?..

Answer / nagalakshmanarao

storage classes in c defines the scope and lifetime of variables.the storage classes are important only in multifunction and multiple file programms.
storage classes are 4 types:they are 1:auto
2:static
3:extern
4:register

Is This Answer Correct ?    0 Yes 0 No

What are Storage Classes in C ?..

Answer / mustaffa hasan

Auto,Static,Extern,Register.Auto are Local variables known
only to the function in which it is declared.Default is
auto.Static are Local variable which exits and retains its
value even after the control is transferred to the calling
function.Global are Global variables known to all functions
in the file.Register are Local variable which is stored in
register.

Is This Answer Correct ?    0 Yes 1 No

What are Storage Classes in C ?..

Answer / sujitpatel

there are 4 types of classes
1 extern
2 static
3 register
4 auto
auto is default storage class which is used as for the
default value . if something s written int a ; then its
default storage is called auto . whereas the scope of the
stATIC and register is for only a file .there is only a
difference that register is used for cpu and static is used
for main memory . the scope of the extern is global it is
used for the whole program .

Is This Answer Correct ?    0 Yes 1 No

What are Storage Classes in C ?..

Answer / vijay r15

storage class is an
attribute that changes
the behaviour of a
variable

There r 4types of
storage classes.They
are
auto
static
extern
register

auto- auto is the
default var type.
ex int x=1 and auto
int x=1 both r same

static- static
variable is a
variable,with in the
scope when it reaches
the initialization it
blindly igores and
hold the updated value

register-reg var tells
the compiler that the
variable will be
heavily used.It is
stored in cpu register

extern- extern var
tells that they have
allocated space in
some other program.
But just using here.
We cant initialize
using extern

with thanks and
regards,
vijay r15,
raj.Vijay55@gmail.Com

Is This Answer Correct ?    2 Yes 4 No

What are Storage Classes in C ?..

Answer / veda

example of global variable----

#include<stdio.h>

int a; /***global variable*********/

void main()
{
int s;
printf("\n enter the value of a--");
scanf("%d",&a);
s=a+3;
printf("\n s=%d",a);

mul(); /****another function********/

getch();


void mul()
{
int m;

m=a*2;

printf("\n m=%d",a);
}


output---
enter the value of a----5

s=8

m=10


when u r compaing this program in lnux we get a waring
because in linux default type is integer so in calling
function we r giving void so internally compailer treate as
a int so,
here type declaration is impartent

Is This Answer Correct ?    21 Yes 25 No

What are Storage Classes in C ?..

Answer / mayank

COMMAND LINE ARGUMENT IN C:::
THE ARGUMENT THAT WE PASS ON TO MAIN() AT THE COMMAND PROMPT
ARE CALLED COMMAND LINE ARGUMENT .........

Is This Answer Correct ?    6 Yes 13 No

What are Storage Classes in C ?..

Answer / mustaffa hasan

what are file reading and coping

Is This Answer Correct ?    1 Yes 11 No

What are Storage Classes in C ?..

Answer / a

a

Is This Answer Correct ?    2 Yes 20 No

What are Storage Classes in C ?..

Answer / shweta

write short note on command line arguments?

Is This Answer Correct ?    15 Yes 38 No

What are Storage Classes in C ?..

Answer / k.anil kumar

AUTO IS A DEFAULT SPECIFIER.THERE IS NO NECESSARY TO
MENTION IT.STATIC FOR LOCAL ANG GLOBAL IS DIFFERENT.STATIC
LOCAL REMAINS KNOWN ONLY TO THE BLOCK WN WHICH IT IS
DECLARED.STATIC GLOBAL IS KNOWN ONLY TO THE FILE.IT IS NOT
SUBJECTED TO ANY SIDE EFFECTS.EXTERN IS JUST A DECLARATION
BUT NOT DEFINITION.FOR INTEGERS AND CHARACTERS , THIS
TYPICALLY MEANS IN THE REGISTER OF THE CPU RATHER THAN IN
MEMORY,WHERE NORMAL VARIABLES ARE STORED.

Is This Answer Correct ?    27 Yes 68 No

Post New Answer

More C Interview Questions

Does c have circular shift operators?

0 Answers  


What is the need of structure in c?

0 Answers  


FILE PROGRAMMING

0 Answers   Wipro,


write a string copy function routine?

2 Answers  


What is a void * in c?

0 Answers  






What is keyword in c?

0 Answers  


Why is malloc used?

1 Answers  


main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }

4 Answers   CitiGroup,


What is an volatile variable?

15 Answers   HP,


How does placing some code lines between the comment symbol help in debugging the code?

0 Answers  


What is a macro?

0 Answers  


What will the code below print when it is executed?   int x = 3, y = 4;         if (x = 4)                 y = 5;         else                 y = 2;         printf ("x=%d, y=%d ",x,y);

0 Answers  


Categories