C Tutorial

This C tutorial teaches the C programming language from the very first line of code up to pointers, structures, dynamic memory and files. C is a small, fast, compiled language created by Dennis Ritchie at Bell Labs in the early 1970s to write the Unix operating system.

More than fifty years later, C is still everywhere. Operating system kernels (Linux, Windows, macOS), databases such as SQLite, embedded firmware in cars and microwaves, and the interpreters of languages like Python and PHP are all written in C.

Why Learn C Programming?

  • C is fast: it compiles directly to machine code with almost no runtime overhead.
  • C teaches you how computers really work: memory, addresses, bytes and the stack.
  • C is portable: a C compiler exists for nearly every processor ever made.
  • C is the foundation of C++, Java, C#, JavaScript and many other languages, so its syntax will feel familiar later.
  • C skills are in demand for embedded systems, operating systems, game engines and performance-critical code.

Your First C Program

Every C program starts running from a function called main. The line #include <stdio.h> brings in the standard input/output library so we can use printf to print text.

#include <stdio.h>

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

The \n at the end of the string is a newline character. return 0; tells the operating system that the program finished successfully.

What This C Tutorial Covers

  • Getting started: installing a compiler and compiling your first program
  • Syntax, comments, variables, data types, constants and operators
  • Input and output with printf and scanf
  • Decisions (if, switch) and loops (while, for)
  • Functions, arrays and strings
  • Pointers, structures and enums
  • Dynamic memory with malloc and free, and file handling

How to Use This Tutorial

Read the lessons in order. Each one has short examples with their output shown underneath, so you can follow along even without a compiler. For the best results, type every example yourself, compile it and change it to see what happens. This tutorial follows the C17 standard, which every modern compiler supports.

Frequently asked questions

Is C hard to learn for beginners?

C has a small, simple syntax, so the basics are quick to learn. The harder parts are pointers and manual memory management, which this tutorial explains step by step.

Should I learn C or C++ first?

Either works. Learning C first gives you a solid understanding of memory and low-level concepts, which makes C++ easier later. If your goal is game development or large applications, you can start with C++ directly.

Is C still used in 2026?

Yes. C is consistently one of the most used languages in the world, powering operating systems, embedded devices, databases and language runtimes.