C Language – Interview Questions
This page contains the **most important, commonly asked C interview questions**,
covering **Basics, Arrays, Pointers, Functions, Memory, Structures, File Handling, Preprocessor**
and tricky output questions—perfect for exams, viva, and placements.
1. Beginner-Level Interview Questions
- What is C language? Who developed it?
- Difference between compiler and interpreter?
- What is a variable? How is it declared?
- Explain keywords in C.
- What is the difference between = and == ?
- What is data type? Give examples.
- What is type casting?
- What are tokens in C?
- Difference between printf() and scanf().
2. Important Theoretical Questions
- What are storage classes? Explain auto, static, extern.
- Explain call by value & call by reference.
- What is recursion?
- What is a pointer? Why is it used?
- What is NULL pointer?
- What are arrays? Difference between 1D and 2D arrays.
- What is a structure? How is it different from array?
- Define dynamic memory allocation (DMA).
- What is a macro? Difference between macro and function?
- What is segmentation fault?
3. Most Expected Coding Output Questions
Example 1: Pointer Output
#include <stdio.h>
int main() {
int a = 10;
int *p = &a;
printf("%d", *p + 5);
return 0;
}
Example 2: Static Variable
#include <stdio.h>
void demo() {
static int x = 0;
x++;
printf("%d ", x);
}
int main() {
demo();
demo();
demo();
return 0;
}
Example 3: Preprocessor Macro
#include <stdio.h>
#define SQR(x) x*x
int main() {
printf("%d", SQR(4+2));
return 0;
}
4. Tricky & Conceptual Questions
- Difference between malloc() and calloc().
- What is dangling pointer?
- What is wild pointer?
- What is memory leak?
- Difference between struct and union.
- What is fseek(), ftell()?
- Difference between text mode and binary mode.
- What is command-line argument? Example usage?
- What is function pointer?
- Why array indexing starts from 0?
5. Frequently Asked Real-World Questions
- How does a C program get stored in memory (Stack, Heap, Code area)?
- Why is C used in OS, embedded systems?
- Difference between C, C++, Java?
- What are uses of pointers in real systems?
- What is volatile keyword?
- What is typedef used for?
- What happens during compilation? Explain phases.
6. Top 20 Final Revision Questions
- Explain different types of loops in C.
- What is union? Give real-life example.
- Explain pointer arithmetic.
- Why is recursion used? One real example.
- Difference between array of pointers & pointer to array.
- What is file pointer? How to open file in C?
- Explain strtok() function.
- Difference between constant pointer and pointer to constant.
- What is bitwise operator? Why used?
- How are strings stored in memory?
- Explain structure padding.
- Difference between strcpy() and strncpy().
- What is segmentation fault?
- Why free() is necessary?
- What is enum? Usage?
- What is inline function (C99)?
- Difference between return and exit.
- Explain do-while with example.
- What is pass-by-reference?
- Explain pointer to function.
Practice Task
Create a C program that asks user for name, age, percentage, and prints them using:
✔ Structures
✔ File Handling
✔ Dynamic Memory
✔ Pointers
✔ Functions