Course contentsShow
C
Lesson 4 of 1,2191. FoundationsFree lesson

Standards: ANSI C vs C99 vs C11

Standards: ANSI C vs C99 vs C11

What you'll learn: You will understand how the C language evolves through official versions and why choosing a "standard" matters for your code.

The Rules of the Road

Think of C like a language like English. Over time, new words are added, and old grammar is simplified. In programming, these updates are called Standards. If everyone wrote C however they wanted, a program written on a Mac might not work on a Windows machine. Standards ensure that "C code" means the same thing to every computer.

The Three Major Eras

While there are many minor updates, three versions define the history of C:

  1. ANSI C (C89/C90): The "Classic" version. It established the core rules we still use today. It is very strict; for example, you had to declare all your variables at the very top of a function before doing anything else.
  2. C99: The "Modernization." This version made C much friendlier. It introduced // for single-line comments and allowed you to declare variables anywhere (like inside a for loop). Most C code written today follows C99.
  3. C11: The "Safety" update. It added features to help computers do multiple tasks at once (multithreading) and made the language more secure against crashes.

Which one should you use?

When you use a compiler (the tool that turns your text into a program), you can actually tell it which version of the rules to follow. If you are learning today, you are likely writing a mix of C99 and C11.

Here is how a simple feature like the "Inline Variable" looks—a luxury we didn't have in the original ANSI C:

#include <stdio.h>

int main() {
    // In ANSI C (C89), we had to put 'int i' at the very top.
    // In C99 and C11, we can create 'i' right inside the loop:
    
    for (int i = 0; i < 5; i++) {
        printf("Standard C is evolving!\n");
    }

    return 0;
}

Why it matters

If you try to run C99 code on an ancient ANSI C compiler, it will scream with errors. As a beginner, knowing these names helps you understand why some older tutorials look slightly different than modern ones. When in doubt, C99 is the "gold standard" that works almost everywhere.

Key takeaway

Standards are the official rulebooks for C; while ANSI C is the foundation, C99 and C11 added the modern conveniences we use today.