Interview Q&A · C · 6 questions in this topic

C Standards & Tooling — C Interview Q&A

All C topics

How the language evolved — C89 to C23, what each revision changed, and the compiler flags that matter. Part of C Fundamentals · 202 questions in the C bank.

What are the C standards (C89, C99, C11, C17, C23) and what did each change?

Answer

C89/C90 is the ANSI baseline every compiler supports. C99 added // comments, mixed declarations, stdint.h, stdbool.h, variable-length arrays and snprintf. C11 added _Static_assert, _Generic, threads (<threads.h>), atomics (<stdatomic.h>) and anonymous structs/unions. C17 fixed defects only. C23 adds constexpr, typeof, auto type inference, bit-precise _BitInt, #embed and decimal floating types.

Compile with -std=c17 (or c11) plus -Wall -Wextra -pedantic so the standard you claim is the standard you get.

Key points

  1. 1C89 — the portable baseline.
  2. 2C99 — stdint/stdbool, declarations anywhere, snprintf, VLAs.
  3. 3C11 — static assert, generics, threads, atomics.
  4. 4C17 — defect fixes; C23 — constexpr, typeof, auto, #embed.

Example

Example.cc
/* gcc -std=c17 -Wall -Wextra -pedantic main.c -o app */
#include <stdint.h>   /* C99: exact-width integers */
_Static_assert(sizeof(int) >= 2, "int too small"); /* C11 */

💡 Pair each standard with one flagship feature — interviewers remember the mapping, not the year list.

What compiler warnings and flags should every C build use?

Answer

At minimum -Wall -Wextra -Werror with an explicit -std (c11/c17), plus -g for debug symbols and -O2 for realistic optimization. Add -Wpedantic, -Wconversion and -fanalyzer for stricter checking, and sanitizers (-fsanitize=address,undefined) in test builds.

Warnings are cheapest bug detection available — a clean -Wall -Wextra build is the entry ticket before any review.

Example

Example.cc
/* gcc -std=c17 -Wall -Wextra -Werror -g -O2 main.c -o app */
/* gcc -std=c17 -fsanitize=address,undefined -g main.c -o app_dbg */

💡 Saying -Werror shows you treat warnings as bugs, which is exactly the team habit interviewers want.

What is the difference between compiler, linker and loader errors?

Answer

Compiler errors are per translation unit: syntax, types, undeclared names — with file/line diagnostics. Linker errors are cross-unit: undefined reference (declared, never defined/linked), multiple definition, missing library paths. Loader errors happen at startup: missing shared libraries, ABI mismatches, bad rpaths.

Read the phase first: the phase tells you where to look (code vs build graph vs deployment).

Key points

  1. 1Compiler — inside one TU: types and syntax.
  2. 2Linker — across TUs: symbols and libraries.
  3. 3Loader — at startup: shared objects and paths.

Example

Example.cc
/* undefined reference to `read_sensor' -> linker: sensor.c missing */
/* error: no matching function      -> compiler: type bug */

💡 Naming the phase before debugging saves most build-investigation time.

Recommended resourcesAffiliate links · may earn us a commission

Classic DSA interview booksThe reference books interviewers themselves learned from — great next to the visualizers.See the books Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits