C Tutorial
Learn C, the "mother of programming languages", from basic syntax to pointers, structures and files.
C is a general-purpose, procedural programming language developed by Dennis Ritchie at Bell Labs in 1972 to write the UNIX operating system. Operating systems, compilers, databases and embedded systems are still written in C.
First C Program
#include <stdio.h>
int main() {
printf("Hello, C!\n");
return 0;
}
Hello, C!
| Part | Meaning |
|---|---|
#include <stdio.h> | Preprocessor directive that includes the standard I/O header (for printf, scanf) |
int main() | Entry point; returns an int to the OS |
printf() | Prints formatted output |
return 0; | Signals successful termination |
Compiling and Running
gcc hello.c -o hello
./hello
Hello, C!
Compilation Stages
Preprocessing (.c → .i) → Compilation (.i → .s assembly) → Assembly (.s → .o object code) → Linking (.o + libraries → executable).
Features of C
- Fast, close to hardware (a "middle-level" language)
- Small set of keywords (32 in C89)
- Pointers and direct memory access
- Rich operators and a portable standard library
Track your progress through the C course