C Tutorial — Learn C Programming
Key takeaway: This free C tutorial teaches you systems programming from scratch — variables, pointers, arrays, functions, structs, and memory management — with practical code examples you can compile and run.
C is a general-purpose, procedural programming language created in 1972. It is used for operating systems, embedded systems, game engines, and performance-critical applications. This tutorial is for beginners, CS students, and developers who want to understand how computers work at a low level.
Last updated: September 2026
Introduction to C Programming
What is C Programming?
C is a powerful general-purpose programming language that's excellent for developing firmware or portable applications. Originally intended for system development work, C has proven to be a powerful and flexible language for applications of all types.
Why Learn C Programming?
Foundation Language
C is the foundation for many modern programming languages including C++, Java, and Python.
High Performance
C programs are fast and efficient, making it ideal for system programming and embedded systems.
System Programming
Perfect for operating systems, device drivers, and other system-level programming tasks.
Portability
C programs can run on various platforms with minimal or no modifications.
Two Ways to Run C Programs
You can run C programs using the following methods:
Run C Online
Use our free online C compiler to start coding immediately without any installation.
Try Online CompilerInstall C Locally
Install a C compiler on your computer for full development capabilities.
Installation GuideInstalling C Compiler on Your Computer
Windows Installation
Install Code::Blocks or Dev-C++
Download and install a C IDE like Code::Blocks or Dev-C++ which includes GCC compiler.
Alternative: Install MinGW
Download MinGW (Minimalist GNU for Windows) for GCC compiler.
Verify Installation
Open Command Prompt and check if GCC is installed:
gcc --versionmacOS Installation
Install Xcode Command Line Tools
Open Terminal and run:
xcode-select --installVerify Installation
Check if GCC is installed:
gcc --versionLinux Installation
Install GCC (Ubuntu/Debian)sudo apt update
sudo apt install gcc
sudo apt update
sudo apt install gccInstall GCC (CentOS/RHEL)sudo yum install gcc
sudo yum install gccYour First C Program
Let's create a simple "Hello World" program to get started:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}How to Run This Program
Save the Code
Save the code in a file named hello.c
Compile the Programgcc hello.c -o hello
gcc hello.c -o helloRun the Program./hello
./helloExpected OutputHello, World!
Hello, World!What's Next?
Now that you've written your first C program, you're ready to dive deeper into C programming concepts: