Interview Q&A · C
C Interview Questions & Answers
All 202 C interview questions — fundamentals, types, functions, pointers, memory, arrays and strings, structs, the preprocessor and build model, file I/O, advanced idioms, processes and threads, plus coding tasks — with correct, up-to-date answers. This bank holds 202 questions across 19 topics and 13 topic groups. Every answer is written for current C versions, and each topic links to matching course lessons where they exist.
Every topic below links to its own page with all of its questions in one place.
Answers are checked against current language behaviour; old-guide claims are corrected.
Each topic points to the matching course lesson, and lessons point back here.
Featured questions in this bank
C Fundamentals
What is C?
C is a general-purpose, statically typed, compiled procedural programming language developed by Dennis Ritchie at Bell Labs (first released in 1972). It provides low-level access to memory through pointers, a small standard…
Read the full answer →C Fundamentals
How does a C program go from source code to a running program?
Four stages: preprocessing (handles #include, #define, conditional compilation), compilation (each translation unit becomes assembly, then object code), linking (object files plus libraries combine into an executable), and…
Read the full answer →Data Types & Variables
What are the fundamental data types and their typical sizes?
Core types are char, short, int, long, long long, float, double, _Bool/bool plus signed/unsigned modifiers. The standard guarantees minimum ranges (int is at least 16 bits) rather than exact sizes — exact sizes are…
Read the full answer →Data Types & Variables
What is the difference between signed and unsigned integers? What goes wrong mixing them?
Signed overflow is undefined behavior; unsigned arithmetic wraps modulo 2^N (defined but often still a logic bug). In mixed expressions the signed operand converts to unsigned (the usual arithmetic conversions), so -1 < 1u is…
Read the full answer →Functions & Recursion
How do function declaration, definition and calls fit together?
A declaration (prototype) gives the signature so callers compile; the definition provides the body exactly once; calls evaluate arguments and transfer control. Since C99, implicit declarations are illegal — every function must be…
Read the full answer →Functions & Recursion
Does C have pass-by-reference?
No — C is strictly pass-by-value: every argument is copied. Reference-like behavior is simulated by passing pointers, letting the callee mutate through them. That is why scanf takes &x and why swap needs int*. The discipline:…
Read the full answer →C Fundamentals
16 questions across 2 topics — What C is, how source becomes a binary, standards and the program lifecycle.
Data Types & Operators
18 questions across 2 topics — Sizes, signedness, promotions, const/volatile/static and control-flow traps.
Functions & Storage
18 questions across 2 topics — Prototypes, pass-by-value, recursion, scope, linkage and storage duration.
Pointers Deep Dive
12 questions across 1 topic — Addresses, arithmetic, const positions, double pointers and dangling bugs.
Dynamic Memory
12 questions across 1 topic — malloc/calloc/realloc/free, heap bugs, layout and leak-free discipline.
Arrays & Strings
20 questions across 2 topics — Decay, sizeof traps, multidimensional layout and safe string handling.
Structs, Unions & Enums
12 questions across 1 topic — Layout and padding, unions, bit-fields, enums and opaque pointers.
Preprocessor & Build
12 questions across 1 topic — Safe macros, headers, linkage, libraries and faster builds.
File I/O, Errors & CLI
12 questions across 1 topic — Robust file handling, errno discipline, getopt and crash-safe writes.
Advanced C Idioms
14 questions across 1 topic — restrict, function pointers, qsort, generic containers and portable C.
Processes & Threads
12 questions across 1 topic — fork/exec, pthreads, data races, mutexes, condvars and atomics.
Tricky Outputs & Coding Tasks
24 questions across 2 topics — Prediction gotchas plus implement-it-now favorites in idiomatic C.
Scenarios & Rapid Fire
20 questions across 2 topics — Judgment calls from real desks, plus one-line revision for the night before.
Recommended resourcesAffiliate links · may earn us a commission