C
The language that built the modern world. C powers operating systems, embedded chips, game engines, and databases. Learning C means learning how computers actually work.

About C
Introduction
What is C?
C is a general-purpose, procedural programming language created in 1972 by Dennis Ritchie at Bell Labs. It was designed to write the Unix operating system, and its influence has been so profound that nearly every major language since β C++, Java, Python, JavaScript, PHP, Rust, Go β borrowed syntax or concepts from it.
Unlike Python, C gives you direct control over memory. You decide where data lives and when it is freed. This makes C exceptionally fast and efficient β ideal for operating system kernels, device drivers, embedded microcontrollers, game engines, and performance-critical applications.
The trade-off is responsibility. C will not stop you from writing to the wrong memory location. Understanding this is exactly why C is such a great teaching language β it forces you to think about what a computer is actually doing at every step.
π‘ Why learn C in 2025?
- βUnderstanding C makes you a better programmer in any language
- βEssential for embedded systems, IoT, and systems programming careers
- βThe Linux kernel, CPython, SQLite, and git are all written in C
- βFoundational for learning C++, Rust, and operating system internals
Curriculum
What you will learn
Hello World & Structure
Program skeleton, #include, main(), printf(), comments and the compilation model.
Variables & Data Types
int, float, double, char, declaring variables, arithmetic operators and scanf() input.
Conditions
if/else if/else, switch statements, ternary operator, comparison and logical operators.
Loops
for, while, do-while loops, break and continue, nested loops.
Arrays & Strings
Declaring arrays, indexing, looping, char arrays as strings, string.h functions.
Functions
Defining and calling functions, return values, scope, pass-by-value, recursion.
Cheat Sheet
C Quick Reference
#include <stdio.h>Include standard I/O libraryint main() { ... }Entry point of every C programint x = 5;Declare & assign an integerfloat f = 3.14;Declare a float (decimal)double d = 3.14159;Higher-precision decimalchar c = 'A';Single character (use single quotes)printf("%d\n", x);Print integer to consolescanf("%d", &x);Read integer from user inputif (x > 0) { ... }Conditional branchfor (int i=0; i<n; i++) { }Counted for loopwhile (x < 10) { }While loopint arr[5] = {1,2,3,4,5};Declare & initialise arrayarr[0]Access first element (index 0)strlen(str)String length (needs string.h)void myFunc() { }Define a void functionreturn 0;Return 0 = success to OSNeed the full tutorial? Start the beginner course β
Preview
What C code looks like
#include <stdio.h>
int main() {
char name[] = "World";
int year = 2025;
printf("Hello, %s!\n", name);
printf("Welcome to C in %d.\n", year);
for (int i = 1; i <= 5; i++) {
printf("Count: %d\n", i);
}
return 0;
}Hello, World! Welcome to C in 2025. Count: 1 Count: 2 Count: 3 Count: 4 Count: 5
#include <stdio.h>
/* Function to get a grade letter */
char getGrade(int score) {
if (score >= 90) return 'A';
if (score >= 80) return 'B';
if (score >= 70) return 'C';
if (score >= 60) return 'D';
return 'F';
}
int main() {
int scores[] = {95, 82, 74, 61, 48};
int n = 5;
for (int i = 0; i < n; i++) {
printf("Score %d β Grade %c\n",
scores[i], getGrade(scores[i]));
}
return 0;
}Score 95 β Grade A Score 82 β Grade B Score 74 β Grade C Score 61 β Grade D Score 48 β Grade F
FAQ
Frequently asked questions
What is C used for?
C is used for operating systems (Linux, Windows kernel), embedded systems, microcontrollers, game engines, databases (SQLite, PostgreSQL), and anywhere performance-critical low-level code is needed. It is the most widely ported language in history.
Is C hard to learn as a first language?
C is more challenging than Python but very rewarding. Because it requires you to manage memory manually and declare types explicitly, it teaches you exactly how computers work. Many computer science courses use C as the first language for this reason.
What is the difference between C and C++?
C++ is a superset of C β it adds object-oriented programming (classes, inheritance, polymorphism), the Standard Template Library (STL), and many modern features. All valid C code is (mostly) valid C++, but C++ code is not valid C. Start with C to understand the fundamentals, then move to C++ for larger projects.
Do I need to install anything to learn C?
To run C code locally you need a compiler such as GCC (Linux/macOS, included in Xcode tools or build-essential) or MinGW-w64 (Windows). You can also use online compilers like OnlineGDB or Compiler Explorer. The examples on this page show expected output without needing any installation.
What comes after learning C basics?
After mastering the basics, the natural next topics are pointers and memory management (malloc/free), file I/O, structs, and dynamic data structures (linked lists, trees). From there you can move to C++ for OOP, or to Rust for a modern memory-safe alternative.
Ready to learn C?
6 modules, 18 examples with full output. Start from zero and build real understanding of how programs work at the hardware level.
The Story of C
Real history, real companies, and an honest look at where Cshines and where it doesn't β not just a feature list.
Where it came from
Dennis Ritchie developed C at Bell Labs between 1969 and 1973, created specifically to rewrite the Unix operating system in something more portable than assembly language. That single decision β that an operating system could be written in a high-level language instead of pure machine instructions β reshaped the entire software industry and is why C is often called the language everything else was built on top of.
How itβs actually used today
Linux, Windows and macOS all have C at their core, and the language remains dominant in embedded systems β the software running inside cars, routers, medical devices and microwaves is overwhelmingly written in C. Database engines like PostgreSQL and Redis, and language runtimes like Python's own CPython interpreter, are themselves written in C.
Strengths & trade-offs
C gives you direct control over memory, which is exactly why it's fast enough for operating systems and embedded hardware β but that same control means you're responsible for every allocation and can introduce serious bugs like buffer overflows if you're not careful. This is precisely the problem Rust was designed to solve decades later.
What to learn next
C++ is the traditional next step, adding object-oriented features on top of C's foundation. Increasingly, developers move to Rust instead for new systems projects, since it offers similar low-level control with memory-safety guarantees C never had.