Interview Prep | C
C Interview Questions

Top asked C interview questions for freshers and experienced developers. Practice and crack your next interview easily 🚀

🔍

C Entry Level Q&A

Back to Top ↑
Q1. What is C language?
A. C is a general-purpose, procedural programming language used for system programming and application development.
Beginner
Q2. What is a pointer?
A. A pointer is a variable that stores the memory address of another variable.
Beginner
Q3. What is a variable?
A. A variable is a named storage location used to hold data.
Beginner
Q4. What is a data type?
A. A data type defines the type of data a variable can hold like int, float, char.
Beginner
Q5. What is a function?
A. A function is a block of code that performs a specific task.
Beginner
Q6. Stack vs Heap?
A. Stack is used for static memory allocation, Heap is used for dynamic memory allocation.
Beginner
Q7. What is malloc?
A. malloc() dynamically allocates memory but does not initialize it.
Beginner
Q8. What is calloc?
A. calloc() allocates memory and initializes it to zero.
Beginner
Q9. What is free()?
A. free() releases dynamically allocated memory.
Beginner
Q10. What is NULL?
A. NULL represents a null pointer that does not point to any memory location.
Beginner
Q11. What is a string in C?
A. A string is an array of characters ending with a null character \0.
Beginner

C Mid Level Q&A

Back to Top ↑
🔍
Q1. What is a function prototype?
A. It declares the function before it is used.
Intermediate
🔍
Q2. What is static keyword?
A. It retains variable value between function calls or restricts scope.
Intermediate
🔍
Q3. What is const?
A. const makes a variable read-only.
Intermediate
🔍
Q4. What is pointer arithmetic?
A. Operations performed on pointers like increment/decrement.
Intermediate
🔍
Q5. What is double pointer?
A. Pointer to a pointer. Example: int **ptr.
Intermediate
🔍
Q6. What is structure?
A. A structure groups variables of different types.
Intermediate
🔍
Q7. What is union?
A. Union shares the same memory among all members.
Intermediate
🔍
Q8. Difference between struct and union?
A. Struct allocates memory for all members, union shares memory.
Intermediate
🔍
Q9. What is recursion?
A. A function calling itself.
Intermediate
🔍
Q10. What is header file?
A. File containing function declarations. Example: stdio.h
Intermediate
🔍
Q11. What is macro?
A. A macro is a preprocessor directive defined using #define.
Intermediate

C Advanced Level Q&A

Back to Top ↑
🚀
Q1. What is volatile?
A. Prevents compiler optimization for variables.
Advanced
🚀
Q2. What is memory leak?
A. Memory allocated but not freed.
Advanced
🚀
Q3. What is dangling pointer?
A. Pointer pointing to freed memory.
Advanced
🚀
Q4. What is buffer overflow?
A. Writing beyond allocated memory.
Advanced
🚀
Q5. What is segmentation fault?
A. Accessing invalid memory location.
Advanced
🚀
Q6. What is function pointer?
A. Pointer that stores address of a function.
Advanced
🚀
Q7. Difference between memcpy and memmove?
A. memcpy fails in overlap, memmove handles overlap safely.
Advanced
🚀
Q8. What is inline function?
A. Function expanded at compile time.
Advanced
🚀
Q9. What is typedef?
A. Used to create alias names for data types.
Advanced
🚀
Q10. What is multi-threading in C?
A. Executing multiple threads using libraries like pthread.
Advanced
🚀
Q11. What is strict aliasing?
A. Rules defining how pointers can access memory.
Advanced