C Programs List — 130+ Examples with Source Code

This page lists 130+ C programs with examples — every program on the site, organised by topic, from simple beginner programs to sorting algorithms, searching, data structures, matrices, strings, and file handling. Each one is a complete, compilable C program with source code and output. Bookmark this page and use it as your practice roadmap: work through a topic, then test yourself with the C aptitude questions.

Jump to a topic: Basics · Arrays · Sorting · Searching · Graphs & Trees · Numbers · Files · Matrix · Linked Lists, Stacks & Queues · Strings

New to C? Set up your compiler first (it takes only a few minutes): Install GCC on Windows 11, on macOS Tahoe, or skip installation entirely with an online C compiler. For the best experience, set up VS Code for C programming.

Simple C Programs

C Programs on Arrays

C Programs For Sorting Algorithms

C Programs for Searching

C Programs on Graphs and Trees

Various C Programs on Numbers

C Programs on Files and File handling

C Programs on Matrix

C Programs on Linked List, Stack & Queues

C Programs on Strings

Go Deeper

Once you’re comfortable with the programs above, these are the site’s in-depth resources:

Practice on the go: our free C Programming Quiz app for Android has 150+ questions across 9 categories covering everything in this list — pointers, arrays, strings, operators, and more.