Getting Started

C Introduction

Learn C — the foundational systems programming language that influenced almost every modern language.

What is C?

C is a general-purpose programming language created by Dennis Ritchie at Bell Labs in 1972. It is one of the most influential programming languages ever created — C, Unix, and Linux were all written in C.

Why Learn C?

  • Foundation of computing: Almost every OS, runtime, and language is built with or influenced by C
  • Performance: Direct memory control, no garbage collector
  • Portability: Runs on everything from microcontrollers to supercomputers
  • Career value: Essential for systems, embedded, and performance-critical programming
  • Understanding the machine: C teaches you how computers actually work

How C Programs Run

  1. Write source code (.c file)
  2. Compile: Convert to machine code (gcc hello.c -o hello)
  3. Run: Execute the compiled binary (./hello)

C vs C++

C is the simpler, procedural language. C++ adds object-oriented features. Most things you learn in C apply directly to C++.

Example

c
#include <stdio.h>

/* Multi-line comment */
// Single-line comment

int main() {
    /* printf sends output to standard output */
    printf("Hello, World!\n");

    /* Variables must be declared with a type */
    int age = 25;
    float price = 19.99f;
    double pi = 3.14159265;
    char grade = 'A';
    char name[] = "Alice";

    /* Formatted output */
    printf("Name: %s\n", name);
    printf("Age: %d\n", age);
    printf("Price: %.2f\n", price);
    printf("Pi: %lf\n", pi);
    printf("Grade: %c\n", grade);

    /* main returns 0 to indicate success */
    return 0;
}
Try it yourself — C