C++ Standards

What Are the C Standards? C89, C99, C11 and Beyond

The C standards explained: C89, C99, C11, C17 and C23, what each added, why they matter for portable code and how to choose one with the compiler flag.

On this page
  1. The Short Answer
  2. Why the Standards Matter
  3. The Versions, in Order
  4. A Small Example
  5. Choosing a Standard
  6. C and C++ Have Separate Standards
  7. Where to Read the Official Text

The Short Answer

The C standards are the formal documents that define the C programming language and its standard library. The International Organization for Standardization (ISO) publishes them. The main versions are C89 (also called C90), C99, C11, C17 and C23. C23 is the newest at the time of writing. C99 and C11 are the versions you will meet most often in tutorials and older code.

C89 was first published by the American National Standards Institute (ANSI) in 1989. ISO adopted the same text in 1990 as C90, so the two names describe the same language.

Why the Standards Matter

A standard is a shared rulebook. It lets different compilers agree on what a program means, so code written to the standard should build and behave the same way on different systems. That is what portability means. Code that depends on one compiler’s extensions may fail to build somewhere else.

The Versions, in Order

C89 / C90. The first standard. It defined the core language and a standard library that includes stdio.h, stdlib.h and string.h.

C95. A small amendment to C90 that added support for wide characters.

C99. A large update. It added // comments, the bool type through <stdbool.h>, fixed-width integer types through <stdint.h>, the long long type, declarations in the middle of a block, for loops that declare their own variable, designated initializers and the restrict keyword.

C11. It added _Generic for choosing code by type, _Static_assert for compile-time checks, _Atomic and <stdatomic.h> for atomic operations, and an optional threads library in <threads.h>. It also removed the unsafe gets() function from the standard.

C17. Sometimes called C18. It fixed defects in C11 and did not add new language features.

C23. Published in 2024. It made bool, true and false keywords, added nullptr, constexpr, typeof, and auto for type inference in variable declarations, and allowed binary literals such as 0b1010. It also added digit separators, so 1'000'000 is valid, and #embed for including binary data in a source file.

A Small Example

#include <stdio.h>

int main(void) {
    for (int i = 0; i < 3; i++) {
        printf("%d\n", i);
    }
    return 0;
}

Compile this with -std=c89 and the compiler will complain about the for loop, because declaring a variable in the loop header came in with C99. Compile it with -std=c99 or a later version and it builds and prints 0, 1 and 2 on separate lines.

Choosing a Standard

Set the version with a compiler flag:

gcc -std=c11 -Wall -Wextra main.c -o main
gcc -std=c17 -Wall -Wextra main.c -o main

Recent GCC and Clang versions accept -std=c23, and older ones use -std=c2x. If you leave the flag out, the compiler uses its own default, which has changed over the years. Setting the flag keeps builds consistent between machines.

For learning, C11 or C17 is a practical choice, since both are well supported and most tutorials are written with them in mind. Use C23 when you want its newer features and your compiler supports them.

C and C++ Have Separate Standards

C++ grew out of C, but the two languages now have separate standards, and they no longer line up. Code that is valid C is not always valid C++. Two examples:

  • In C, a void * converts to another pointer type without a cast, so int *p = malloc(sizeof *p); compiles. In C++, the same line needs an explicit cast.
  • C++ reserves words such as class, new and template as keywords. C lets you use them as variable or function names.

The C++ release history is a separate topic, covered in our guide to the latest c standard for C++.

Where to Read the Official Text

ISO sells the published standards, so many people read free drafts instead. The working group that maintains C, WG14, posts its drafts on the open-std.org document site. Drafts are close to the final text but not identical, so use the published standard when you need the exact wording.

The complete guide to c++ standards

The Latest C++ Standard
Read the guide

Keep exploring

Guides from other topics

All topics →

Should I Learn C++?

C++ is worth learning for games, embedded systems and performance-critical software, but it is demanding. Here is how to decide if it suits your goals.