C

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

Hello World Program in C

Let's create your first C program! The "Hello World" program is a simple program that displays "Hello, World!" on the screen.

Basic Hello World Program

hello.c
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}

Code Explanation

#include <stdio.h>

This is a preprocessor directive that includes the standard input/output library, which contains the printf() function.

int main()

This is the main function where program execution begins. Every C program must have a main() function.

printf("Hello, World!\n");

This function prints the text "Hello, World!" to the screen. The \n is an escape sequence for a new line.

return 0;

This statement returns 0 to the operating system, indicating that the program executed successfully.

How to Compile and Run

1
Save the Code

Save the code in a file named hello.c

2
Compile

Open terminal and run: gcc hello.c -o hello

3
Execute

Run the program: ./hello (Linux/Mac) or hello.exe (Windows)

Output

When you run this program, you will see:

Hello, World!

Explanation

  • #include <stdio.h>: Brings in functions like printf() from the standard I/O library.
  • int main(): Program entry point where execution begins. Must return an int.
  • printf(): Prints text to the console; \n adds a newline so the shell prompt appears on the next line.
  • return 0;: Signals successful completion to the operating system.
Keywords
Hello World, stdio.h, printf, main function, compile and run
Quick Tips
  • Compile with gcc hello.c -o hello and run ./hello.
  • Every statement ends with a semicolon; missing it causes compile errors.
  • Use meaningful file names and keep examples small while learning.

Frequently Asked Questions

C is a foundational systems programming language that's been around since the 1970s. It's the base for Linux, Windows, and most operating systems. Learning C gives you deep understanding of memory, pointers, and how computers work — skills that transfer to every other language. According to the TIOBE Index, C consistently ranks in the top 2 most popular languages.

No, zero experience needed. Our C programming tutorial is designed for complete beginners. We start with Hello World and gradually progress to pointers and memory management. Basic computer literacy and logical thinking are helpful but not required.

Just a C compiler — or use our free online compiler. For beginners, our online C compiler requires no installation. For local development, use GCC (available on all platforms). IDEs like VS Code, Code::Blocks, or Dev-C++ also work well.

2–4 weeks for basics, 3–6 months for proficiency. With 1–2 hours daily practice, you can learn syntax, loops, and functions in a few weeks. Mastering pointers, memory management, and data structures takes 6–12 months. Practice with our C programming examples.

C programming skills open doors to various career paths including system programming, embedded systems development, operating system development, device driver programming, game development, and firmware development. Many companies in automotive, aerospace, telecommunications, and IoT sectors actively seek C programmers.

Yes, extremely relevant. C consistently ranks in the top 2 on TIOBE and powers Linux, embedded systems, IoT, automotive software, and game engines. Understanding C makes you a better programmer in any language since most runtimes (Python, Java, Node.js) are themselves written in C.