C course menu
Introduction to C Programming: What It Is, Where It Is Used, and Why Learn It
A beginner-friendly introduction to the C programming language: what C is, its history, where it is used (operating systems, embedded devices, databases, compilers), how C programs are compiled, how C compares with C++, Java and Python, and what you will learn in this course.
On this page
C is a small, fast, general-purpose programming language. It gives you close control over the computer's memory and hardware, while still being far easier to write than assembly language. For more than fifty years it has been the language underneath much of the software the world depends on.
A first look#
Here is a complete C program:
#include <stdio.h>
int main(void) {
printf("Hello, C!\n");
return 0;
}Hello, C!Every C program starts running in a function called main. printf (from the standard input/output library, stdio.h) prints text. You will write and run this program yourself in First C Program.
A little history#
C was created by Dennis Ritchie at Bell Labs in the early 1970s, largely to write the Unix operating system. The book The C Programming Language by Brian Kernighan and Dennis Ritchie (1978) made it widely known. C is standardised by ISO; the versions are named after their years, such as C99, C11, C17 and C23. This course uses standard C that works with any modern compiler.
Where C is used#
Because so much infrastructure is written in C, it is essential for embedded and systems programming roles (see the Embedded Systems Engineer path), and many university courses start with it.
How C programs run#
C is a compiled language:
- You write source code in
.cfiles. - A compiler (such as GCC or Clang) translates it into machine code for your processor, producing an executable file.
- You run the executable directly. No interpreter or virtual machine is needed, which is one reason C programs are fast and small.
What makes C different#
- Close to the hardware. You work directly with memory addresses through pointers.
- Manual memory management. You request memory with
mallocand must give it back withfree; there is no garbage collector. - Small language. C has only a few dozen keywords. There are no classes, exceptions or built-in strings; you build those ideas yourself.
- Few safety nets. Reading past the end of an array is not caught automatically. It can crash the program or silently corrupt data, as you will see in Undefined Behaviour.
This makes C powerful and educational: learning C teaches you how computers actually store and move data, which helps with every other language.
C compared with other languages#
C++ began as an extension of C, and most C code is also valid C++. If you later want classes, templates and a large standard library, continue with the C++ course.
What you will learn#
- Fundamentals: variables, types, operators, and input and output with
printfandscanf. - Conditions and loops.
- Functions, scope and recursion.
- Arrays and strings.
- Pointers, from the basics to function pointers.
- Dynamic memory and how to find memory bugs.
- Structs, unions, enums, linked lists, stacks and queues.
- Files, the preprocessor, multi-file programs, bitwise operators and error handling.
Key takeaway#
Finished this lesson?