Skip to content
  • Introduction to C · C

Introduction to C

Mani Deep @manideep· 2 min read

Copied from “Introduction to C” by LearnViaNotes

A small, fast, portable systems language — the language of operating systems, embedded devices, databases and the runtimes of most other languages.

A short history

YearMilestone
1972Dennis Ritchie creates C at Bell Labs (successor of B) to rewrite UNIX.
1978The C Programming Language (K&R) by Kernighan & Ritchie — the de-facto standard, “K&R C”.
1989 / 1990C89 / C90 — the first ANSI / ISO standard (“ANSI C”). Function prototypes, void, const.
1999C99 — // comments, long long, <stdint.h>, bool, VLAs, designated initializers, inline, mixed declarations.
2011C11 — _Generic, _Static_assert, anonymous structs/unions, <threads.h>, <stdatomic.h>, _Alignas; gets removed.
2018C17 (C18) — bug-fix release of C11, no new features. The default standard for these notes.
2024C23 — bool/true/false as keywords, nullptr, constexpr, typeof, #embed, binary literals 0b1010, [[attributes]].

Why learn C?

The trade-off

C gives youC does NOT give you
Raw pointers and manual memory controlGarbage collection, bounds checks, null safety
Structs, unions, functionsClasses, inheritance, templates, exceptions
A tiny standard libraryBuilt-in strings, lists, maps, networking
Speed and controlProtection from undefined behaviour — mistakes compile and silently misbehave

Hello, world

C
#include <stdio.h>

int main(void) {
    printf("Hello, world!\n");
    return 0;
}
Output
Hello, world!
Terminal
$ gcc hello.c -o hello        # compile (or: clang hello.c -o hello)
$ ./hello                     # run
Hello, world!
$ echo $?                     # exit status returned by main
0

Is C a high-level or low-level language?

What is the difference between C and C++?

Study aids

Made by AI from this note: a summary, key concepts, questions to practise with, a quiz and flashcards.

C is a small, fast, portable, statically typed compiled language that gives direct memory access through pointers and has no garbage collector, bounds checking or exceptions. Created by Dennis Ritchie at Bell Labs in 1972 to rewrite UNIX, it has evolved through standards from K&R C (1978) to C89/C90, C99, C11, C17 (the default for these notes) and C23 (2024). It runs in Linux, Windows and macOS kernels, embedded firmware, SQLite, Redis, Git, CPython and more. Its trade-off is raw control and speed in exchange for no protection from undefined behaviour. C is case-sensitive, uses ; to end statements and { } for blocks, and is usually called a middle-level language; C++ is almost a superset that adds classes, templates, exceptions and the STL.

  • C is a small, fast, portable, statically typed, compiled, procedural language with direct memory access through pointers.

  • C has no garbage collector, no bounds checking and no exceptions; it trusts the programmer.

  • Dennis Ritchie created C in 1972 at Bell Labs (successor of B) to rewrite UNIX.

  • Standards history: K&R C (1978), C89/C90 (ANSI/ISO), C99, C11, C17 (the default for these notes, a bug-fix release of C11), and C23 (2024).

  • Used in Linux, Windows and macOS kernels, embedded firmware, SQLite, Redis, Git, CPython, the JVM and Nginx.

  • C gives raw pointers, structs, unions and a tiny standard library; it does not give classes, garbage collection, bounds checks or built-in strings.

  • C programs are case-sensitive, statements end with ;, and blocks use { }; whitespace does not matter to the compiler.

  • C is usually called a middle-level language: high-level constructs with low-level access that maps closely to machine instructions.

  • C++ started as 'C with classes' and is almost a superset of C, adding classes, templates, references, RAII, exceptions, namespaces and the STL.

  • Compile hello.c with gcc or clang (e.g. gcc hello.c -o hello) and run it with ./hello.

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report