Skip to content

c99_booleans

Fábio Gaspar edited this page Jan 15, 2019 · 1 revision

Booleans

On the original C standard there's no support for booleans types. A boolean has two possible values. It either is true or is false. Starting with C99, a library was introduced which enables the boolean type.

#include <stdbool.h>

int main() {
  bool a = true;

  return 0;
}

Until C99, or even today when developing software for architectures with out of date compilers, it was possible to kind of create a boolean data type. It's very simple. Later on we will see how it works.