Skip to content
Learn Netverks

Lesson

Step 11/36 31% through track

preprocessor-intro

Preprocessor intro

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~1 min
Level
beginner

This lesson

An orientation to the C track—how the compiled playground works, core vocabulary, and what you will practice next.

You need a clear map of the C track so pointers, the stack/heap, and manual memory do not feel like magic.

You will apply Preprocessor intro in contexts like: Kernels, drivers, embedded devices, and performance libraries used by other languages.

Write C in main.c with int main(), click Run on server—the dev runner compiles with cc/gcc -std=c11 and runs the binary; read stderr for compile and linker errors (LEARNING_RUNNER_ENABLED=true). Also read the interview prep blocks.

After variables and functions in JavaScript or Java—C is low-level; prior imperative experience is strongly recommended.

Before compilation, the preprocessor handles #include, #define, and conditional compilation. Lines starting with # are preprocessor directives.

#include

#include <stdio.h>   /* system header */
#include "mylib.h"   /* project header */

#define macros

#define MAX_SIZE 100
#define SQUARE(x) ((x) * (x))

Prefer const variables and inline functions for new code; macros remain common in headers and embedded configs.

Include guards

#ifndef MYLIB_H
#define MYLIB_H
/* declarations */
#endif

Important interview questions and answers

  1. Q: Macro vs const?
    A: Macros are text substitution without type checking; const variables are typed and debuggable.
  2. Q: Why include guards?
    A: Prevent duplicate definitions when headers are included from multiple paths.

Self-check

  1. What does #include do?
  2. Why wrap macro arguments in parentheses?

Interview prep

Macro vs const?

Macros are text substitution without type checking; const variables are typed, scoped, and debuggable.

Include guard purpose?

Prevent the same header from being processed twice, which would duplicate struct tags and function prototypes.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Macro danger?
  • #include guards?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump