C Programming Course / Headers, Includes, and the Preprocessor

Course contents

Beginner

  1. C Programming: A Practical Overview
  2. Set Up a C Compiler and Build Loop
  3. Write and Run Your First C Program
  4. Understand C Program Structure
  5. C Data Types and Object Sizes
  6. Variables, Initialization, and Constants
  7. Operators, Expressions, and Conversions
  8. Read and Validate Console Input
  9. Make Decisions with if and switch
  10. Repeat Work with C Loops
  11. Create and Use C Functions
  12. Arrays and Bounds in C
  13. Multidimensional Arrays
  14. C Strings and Safe Formatting

Intermediate

  1. Bitwise Operators and Flags
  2. Scope, Lifetime, and Storage Duration
  3. Structures, Enumerations, and Unions
  4. typedef and Readable Type Names
  5. Pointers, Addresses, and Dereferencing
  6. Pointer Arithmetic and Array Traversal
  7. Function Pointers and Callbacks
  8. Recursion and Base Cases
  9. Dynamic Memory with malloc and free
  10. Headers, Includes, and the Preprocessor
  11. Header Files and Multi-File Programs
  12. Read and Write Files in C
  13. Command-Line Arguments
  14. Navigate the C Standard Library
  15. Error Handling with Return Values and errno
  16. Sorting and Searching with qsort and bsearch
  17. Compiler Warnings, Tests, and Debugging
  18. Build a Small Stack with an Array
  19. Linked Lists and Ownership

Advanced

  1. Declarations, Definitions, Scope, and Linkage
  2. Integer Promotions, Conversions, and Overflow
  3. const, volatile, restrict, and Aliasing
  4. Object Representation, Alignment, and Endianness
  5. Designated Initializers and Compound Literals
  6. Advanced Macros and Variadic Functions
  7. Threads, Atomics, and the C Memory Model
  8. Undefined, Unspecified, and Implementation-Defined Behavior
  9. C Standards, Compiler Modes, and Portability
  10. C23 Features and Migration Considerations
  11. Optional and Version-Specific C Features
  12. Performance Measurement and Optimization
  13. Secure C: Bounds, Ownership, and Input Boundaries

Expert

  1. Object Files, Linkers, and ABI Boundaries
  2. Static Analysis, Sanitizers, and Fuzz Testing
  3. Designing Stable and Testable C APIs
  4. Capstone: A Defensive Command-Line Record Tool

C Programming • C17 baseline, standards-specific features labeled

Headers, Includes, and the Preprocessor

Share declarations through guarded headers and keep macros simple and side-effect free.

The preprocessor handles directives before compilation. A header guard prevents a header from being processed repeatedly in one translation unit. Prefer typed functions or enum constants over function-like macros when they provide the same behavior.

Example

#ifndef POINT_H
#define POINT_H

struct point {
    double x;
    double y;
};

#endif

What to expect

Including point.h declares struct point once per translation unit.

Key idea: Headers should expose declarations; keep ordinary function implementations in source files.