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
What is #define used for in c?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
Why is c so powerful?
How can I avoid the abort, retry, fail messages?
What's the total generic pointer type?
What is omp_num_threads?
By using C language input a date into it and if it is right?
What is time complexity c?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
When should a type cast be used?
What is the use of parallelize in spark?
Why isn't it being handled properly?
What is use of integral promotions in c?
Do pointers store the address of value or the actual value of a variable?