Learn C

C is one of the oldest and most influential programming languages still in everyday use, and it is a great place to start if you want to understand how computers really work.

C is a general-purpose programming language created by Dennis Ritchie in the early 1970s at Bell Labs. It was designed to be small, fast, and close to the hardware, which is why it is still used today to build operating systems, databases, and other software where speed and control matter.

Why Learn C?

Learning C teaches you the ideas that almost every other language borrows: variables, memory, functions, and loops. Once you understand C, languages like C++, Java, and Python feel familiar.

  • C is fast because it compiles directly to machine code that the processor runs.
  • C gives you direct control over memory, which helps you understand what a program is really doing.
  • The Windows, Linux, and macOS operating systems are all built largely in C.
  • Knowing C makes it easier to learn C++, C#, Java, and many other languages.

Your First Look at C

Here is a complete C program. Do not worry about understanding every line yet; the goal right now is just to see what C looks like. This program prints a short message to the screen.

A first C program

#include <stdio.h>

int main() {
    printf("Hello, I am learning C!");
    return 0;
}

The line that does the visible work is printf, which sends text to the output. You will use printf constantly, so here is a second tiny example that prints a number instead of a sentence.

Printing a number

#include <stdio.h>

int main() {
    printf("%d", 2026);
    return 0;
}
Note: Every full C program needs a function called main. When you run the program, the computer starts reading your instructions from inside main.

What You Will Need

ToolPurpose
A text editorWhere you type your C code
A C compilerTurns your code into a program the computer can run
A terminalWhere you run the compiled program and see the output
Note: Take your time with the early topics. C rewards patience, and the basics you learn here will carry you through everything that comes later.

Exercise: C Introduction

Which programmer created the C language in the early 1970s?

Frequently Asked Questions

Should I learn C as a first language?
C teaches how memory and pointers actually work, which makes every later language clearer. It is less forgiving than Python, so it is a slower start but a deeper foundation.
What is the difference between C and C++?
C++ began as C with classes and now adds object-oriented programming, templates, and a large standard library. Most C code compiles as C++, but the two encourage very different styles.
Is C still used today?
Widely. Operating system kernels, embedded firmware, databases and language runtimes are written in C, largely because it compiles to predictable machine code with no runtime overhead.