typestar

Include guards in C

A header may be included many times, so it must protect itself.

#ifndef TYPESTAR_TOUR_H
#define TYPESTAR_TOUR_H

#include <stddef.h>

typedef struct {
    const char *slug;
    size_t steps;
} Tour;

size_t tour_steps(const Tour *tour);

#endif /* TYPESTAR_TOUR_H */

How it works

  1. The guard macro is defined on the first pass.
  2. Later passes see it defined and skip the body.
  3. The name is conventionally the file name shouted.

Keywords and builtins used here

The run, in numbers

Lines
13
Characters to type
194
Tokens
33
Three-star pace
100 tpm

At the three-star pace of 100 tokens a minute, this run takes about 20 seconds.

Type this snippet

Step 1 of 2 in Headers & conditions, step 8 of 12 in Preprocessor & headers.

← Previous Next →