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

2. Important Theoretical Questions

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

5. Frequently Asked Real-World Questions

6. Top 20 Final Revision Questions

  1. Explain different types of loops in C.
  2. What is union? Give real-life example.
  3. Explain pointer arithmetic.
  4. Why is recursion used? One real example.
  5. Difference between array of pointers & pointer to array.
  6. What is file pointer? How to open file in C?
  7. Explain strtok() function.
  8. Difference between constant pointer and pointer to constant.
  9. What is bitwise operator? Why used?
  10. How are strings stored in memory?
  11. Explain structure padding.
  12. Difference between strcpy() and strncpy().
  13. What is segmentation fault?
  14. Why free() is necessary?
  15. What is enum? Usage?
  16. What is inline function (C99)?
  17. Difference between return and exit.
  18. Explain do-while with example.
  19. What is pass-by-reference?
  20. 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