Real C projects split code across many .c files with headers and build with Make, CMake, or Meson. The playground stays single-file, but the layout below is what you use locally.
Typical layout
project/
include/mylib.h
src/mylib.c
src/main.c
Makefile
Build example
CC=gcc
CFLAGS=-std=c11 -Wall -g
main: main.o mylib.o
$(CC) -o main main.o mylib.o
Important interview questions and answers
- Q: Why static functions?
A: Limit symbol visibility to one translation unit—avoids linker name collisions. - Q: CMake vs Make?
A: CMake generates build files cross-platform; Make is simpler for small projects.
Self-check
- What tool invokes the linker in a Makefile?
- Where do public declarations usually live?
Interview prep
- static function?
Internal linkage—symbol visible only within its translation unit, avoiding name collisions.