C Programming Examples - Free Download

I supplement each tutorial with a number of c programming examples. Here you will find them all in one place!

GitHub

Recently I started to upload all the C source code examples and demos on ProgrammingSimpleSteps' GitHub.
This is the only place where I will upload new examples and update the existing ones.

    git clone https://github.com/ProgrammingSimpleSteps/c-examples.git

Advertise on this site. I promise you will like the rates :)

Download a zip from here - deprecated

Note: I will no longer update the source code provided in the .zip files that you can download from here. The preferred way to access the examples is our repository on GitHub. If you are making your first steps in the world of programming you need to learn to navigate GitHub anyway. Also I strongly suggest that you learn how to work with Git itself. It is the most widely used version control system as of today(2021).

You can(and I strongly recommend that you do) download and test the C source code examples on your machine. They are regular .c (source file) and .h (header file) files. For convenience all files in one example are zipped in an archive, so you have to download only one file for one example.

To use them:

  • Download the zip file          
  • Unzip it.
  • Use the source file - compile it/or create a project with it.

That's it :-)

C programming examples for section... keywords

Source download Article
--- auto
--- break statement
c-char.zip char
c-const.zip const
--- continue statement
do-while-loop.zip do while loop
--- double
--- enum
c-extern-examples.zip extern
--- float
for-loop.zip for loop
goto-statement.zip goto statement
--- if..else
--- int
--- register
return statement.zip return statement
--- sizeof
static-keyword-in-c.zip static
struct.zip structure in C
switch statement examples switch statement
typedef.zip typedef in C
union.zip union in C
void.zip void
--- volatile
while-loop.zip while loop

Examples for "Number Systems"

Source download Article
dec-to-bin.zip Decimal to binary
decimal-to-octal.zip Decimal to octal
dec-to-hex.zip Decimal to hex
bin-to-dec.zip Binary to decimal
bin-to-hex.zip Binary to hex
hex-to-decimal.zip hex to decimal
hex-to-bin.zip hex to binary
octal-to-decimal.zip octal to decimal

Renaming files

This example uses the dirent.h library to list files in a given folder and rename them with consecutive names like "f-01", "f-02", and so on.

Converting from decimal to fraction

Converting a decimal number to a fraction involves expressing the decimal as a ratio of two integers (a numerator and a denominator).

For the new guys

Many of you are here, because you are following some of my tutorials and want to see the c programming examples associated with a given lesson.

However, chances are that some of you came here, because you are looking for C source code examples in general. Those of you probably are making your first steps in the world of programming and C in particular. For you, I strongly recommend my C Programming Tutorial, where you will start from the beginning and setup your development environment in order to actually run the C source code examples.

   Search this site: