Lesson 9 +10 XP

C Language Standards

C Language Standards

C has grown every so often, with a new standard from time to time.

The timeline

  • C89 (1989) also C90 - the groundbreaking first big standard version.
  • C99 (1999) - added new types and features.
  • C11 (2011) - better threading, type generic macros, improved security.
  • C17 (2017) turning up some details.
  • C23 (2023) - brand new modernization.

What changes between?

Newer standards add features, fix issues, and the compiler may change slight behavior. Old C code usually compiles with new standards too.

Which version should I use?

  • For new projects, a commonly used "modern" default is C11 (or C17).
  • Some embedded systems use older C (C89/ C99) because their compiler supports only that.
  • The lightweight C standard lacks:
gcc -std=c11 myprog.c -o myprog

Compiler dialect differences

Compilers may also have extensions beyond the standard that turn on certain syntax. Keep code portable to real compiler not specialized.

TL;DR

  • Standards: C89 → C99 → C11 → C17 → C23.
  • C11/C17 is a sensible modern default.
  • Flags: -std=c11 or -std=c2x alt.
  • Embedded/delivers may stick to older standards.