Skip to content
Tutorials Center
My learning

Topics

C Reference ยท Concepts and Tools

C language standards: C89 to C23

A timeline of the C standards from C89 to C23: what each added, how to select one with -std, and how to test for it in code with __STDC_VERSION__.

C is defined by an ISO standard that has been revised several times. Each revision is usually named by the year it was approved, and the compiler reports which one it is following through the predefined macro __STDC_VERSION__. Compilers add flags such as -std=c11 to choose; they implement parts of newer standards before they are finished, and library support (the C library, not the compiler) often lags behind.

Knowing the timeline helps in two ways: you can tell which features a given compiler or exam expects, and you can write headers that adapt to the standard in use.

Try it

C Which standard is this?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

C One feature from each era

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

The standards

Name Official __STDC_VERSION__ Main additions
K&R C none (1978 book) none Original language; function parameters declared separately.
C89 / C90 ANSI X3.159, ISO/IEC 9899:1990 not defined (only __STDC__) First standard: prototypes, void, const, volatile, <stdlib.h> and friends. C90 is the same language with ISO wording.
C95 (Amendment 1) 1995 199409L Wide characters (<wchar.h>, <wctype.h>), digraphs, <iso646.h>.
C99 ISO/IEC 9899:1999 199901L // comments, mixed declarations and code, long long, <stdint.h>, <stdbool.h>, variable-length arrays, inline, restrict, designated initializers, compound literals, flexible array members, <complex.h>, <tgmath.h>, snprintf, __func__.
C11 ISO/IEC 9899:2011 201112L _Generic, _Static_assert, _Noreturn, _Alignas/_Alignof, _Atomic, <threads.h>, <stdatomic.h>, anonymous structs and unions, quick_exit, Unicode <uchar.h>; VLAs and some library parts became optional.
C17 (C18) ISO/IEC 9899:2018 201710L Bug fixes and clarifications to C11 only; no new features.
C23 ISO/IEC 9899:2024 202311L nullptr, constexpr, typeof, bool/true/false as keywords, [[attributes]], auto type inference, #embed, _BitInt, binary literals, digit separators, <stdbit.h>, <stdckdint.h>, empty initializer {}, static_assert without message, UTF-8 char8_t, removal of K&R definitions.

Details of the two latest revisions: What is new in C11 and What is new in C23.

Choosing a standard

TEXT
gcc -std=c89 ...        # also -ansi
gcc -std=c99  / c11 / c17 / c23     # strict ISO; older GCC calls C23 "c2x"
gcc -std=gnu11 / gnu23   # the same plus GNU extensions (GCC's default is a gnu mode)
gcc -pedantic-errors     # reject anything the chosen standard forbids
  • -std=cXX turns off GNU extensions that conflict with the standard and defines __STRICT_ANSI__. This hides some POSIX functions; ask for them with #define _POSIX_C_SOURCE 200809L before the first include.
  • -std=gnuXX keeps extensions and exposes POSIX and GNU functions by default.
  • MSVC: /std:c11, /std:c17; C23 support is partial.

Usage notes

  • Compiler support is gradual. A compiler may accept a C23 feature long before its standard library has the matching header; <stdbit.h> needs a recent C library, which is why it is not available in the online runner.
  • Check features, not versions, when you can: __has_include(<stdckdint.h>), __has_c_attribute(nodiscard), __STDC_NO_VLA__, __STDC_NO_THREADS__. See __has_include.
  • Which should you use? Target C11 or C17 for maximum portability today, C23 when you control the compiler. Embedded vendors often stop at C99.
  • Behavior that does not change: undefined behavior, implementation-defined behavior and unspecified behavior exist in every version. See Undefined behavior.
  • Obsolete features: implicit int, implicit function declarations and K&R definitions (int f(a) int a; {...}) were removed in C99 or C23 even though old compilers still accept them with a warning.
  • Mixing standards. Headers meant to be included from C++ need extern "C" guards; C++ is a separate language with its own standard.