What are Storage Classes in C ?
Answer Posted / monika
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 ? | 31 Yes | 4 No |
Post New Answer View All Answers
Why is c called a mid-level programming language?
Can a function argument have default value?
What is string function in c?
write a program to find out prime number using sieve case?
Is swift based on c?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
What are predefined functions in c?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
what is event driven software and what is procedural driven software?
write a program to create a sparse matrix using dynamic memory allocation.
What is a scope resolution operator in c?
What is a program flowchart and how does it help in writing a program?
can anyone suggest some site name..where i can get some good data structure puzzles???
What is structure packing in c?