I this post we have provided part 1 of the most common C interview questions along with answers. We recommend you to try to answer the questions, before referring to the given answer. If you find any mistake or a better alternate solution we are happy to see your suggestions and comments
1. What are the different storage class supported in C?
2. What is the difference between variable declaration and definition?
Ans : Declaration does not point to any memory location while by definition of variable points to specific memory location. Use of extern keyword during variable declaration makes it declaration every other declaration is definition.
3. What is the difference between variable initialization and assigning?
Ans : When the value is assigned during the definition of the variable it is initialization if assigned any where else it is assignment
4. What are the different memory segments supported in C?
- Data – Environment, Global and Stack
5. What is the difference between structure and union?
Ans : In structure each member occupies consecutive memory location in union all the members share the same memory location.
6. What is the size of variable to union?
Ans : Size will be equal to the member with largest data type
7. What will be the size of variable to the following structure?
Ans : due to padding size will be 2 times the size of integer
8. What is the type of structure used to implement linked list?
Ans : Self referencing structures
9. How to implement linked list without using self referencing structures?
Ans : Using opaque pointers
10. What is a opaque pointer?
Ans : A pointer to a void data type. Example void *ptr;