C Language Interview Question and Answers
71. |
What is storage class? What are the different storage classes in C? |
|
Storage class is an attribute that changes the behavior of a variable. It controls the lifetime,scope and linkage. The storage classes in c are auto, register, and extern, static, typedef. |
|
Sravani, says |
Feb 14, 2014 |
Te storage classes are as follows automatic(auto):this type of storage class will be stored in RAM(in stack ) , its lifetime end and starts with process and it has no linkage since it not accessible to other function. Register :register storage class behaviour is same auto but only difference is it is copied in registers in cpu for optimization. static:static storage class memory is in data section in hard disk and its space is only for function and accessible only for a function extern: extern is global accessible ,its storage is in data section in hard disk and it start and end with process. |
Saurabh, said |
Feb 03, 2014 |
There are following types of storage classes in c - Auotmatic : Whose storage is in RAM and the keyword used for this class is auto.
- Register : Whose storage is in Register and the keyword used for this class is register.
- Extern /Global : Whose storage is in RAM and the keyword used for this class is extern.
- Static : Whose storage is in RAM and the keyword used for this class is static.
|
janardhan, said |
Jan 07,2014 |
Void pointer is a generic pointer.by using this pointer we can access any type of data with type casting.
|
|
72. |
What the advantages of using Unions? |
|
When the C compiler is allocating memory for unions it will always reserve enough room for the largest member. |
|
|
73. |
What is the difference between Strings and Arrays? |
|
String is a sequence of characters ending with NULL .it can be treated as a one dimensional array of characters terminated by a NULL character. |
|
|
74. |
What is a huge pointer? |
|
Huge pointer is 32bit long containing segment address and offset address. Huge pointers are normalized pointers so for any given memory address there is only one possible huge address segment : offset pair. Huge pointer arithmetic is doe with calls to special subroutines so its arithmetic slower than any other pointers. |
|
|
75. |
In C, why is the void pointer useful? When would you use it? |
|
The void pointer is useful because it is a generic pointer that any pointer can be cast into and back again without loss of information. |
|
|