Note that the tutorials are displayed in order of difficulty! (From beginner to experienced.)

C Tutorial – More on Pointers

In the previous C programming language tutorial we looked at the fundamentals of pointers. In this C tutorial we will look at some specifics of pointers.

Initialize a pointer

Before you can use a pointer in for instance a printf statement, you have to initialize the pointer.
The following example will not initialize the pointer: More »


Posted in C Tutorials | 32 Comments


C Tutorial – strings and string Library Functions

Important: Before you start this tutorial, did you follow the pointers and more on pointers tutorials? Strings and pointers are intertwined to a large extent.

A string in the C language is simply an array of characters. Strings must have a NULL or \0 character after the last character to show where the string ends. A string can be declared as a character array or with a string pointer. First we take a look at a character array example: More »


Posted in C Tutorials | 12 Comments


C Tutorial – printf, Format Specifiers, Format Conversions and Formatted Output

In this C programming language tutorial we take another look at the printf function. We will look at how to use format specifiers to print formatted output onto the screen. The topics covered are; a little printf background, format specifiers and conversions, formatting of different types and format conversions of strings. More »


Posted in C Tutorials | 145 Comments


C Tutorial – structures, unions, typedef

In the C language structures are used to group together different types of variables under the same name. For example you could create a structure “telephone”: which is made up of a string (that is used to hold the name of the person) and an integer (that is used to hold the telephone number).
Take a look at the example: More »


Posted in C Tutorials | 73 Comments


C Tutorial – File I/O (using text files)

The file I/O functions and types in the C language are straightforward and easy to understand. To make use of these functions and types you have to include the stdio library. (Like we already did in most of the tutorials).

The file I/O functions in the stdio library are: More »


Posted in C Tutorials | 31 Comments


C Tutorial – The functions malloc and free

The function malloc is used to allocate a certain amount of memory during the execution of a program. The malloc function will request a block of memory from the heap. If the request is granted, the operating system will reserve the requested amount of memory.

When the amount of memory is not needed anymore, you must return it to the operating system by calling the function free.

Take a look at the following example: More »


Posted in C Tutorials | 39 Comments


C Tutorial – Binary File I/O

In an earlier tutorial we talked about file I/O functions and the use of text files. In this C programming tutorial we are going to talk about the use of binary files.

Binary files

Binary files are very similar to arrays of structures, except the structures are in a disk-file rather than an array in memory. Binary files have two features that distinguish them from text files: More »


Posted in C Tutorials | 32 Comments


C Tutorial – Deleting and Renaming a File

In two previous tutorials we talked about file I/O functions on text files and file I/O functions on binary files. In this C programming language tutorial we look at how to remove files and how to rename a file. More »


Posted in C Tutorials | 12 Comments


C Tutorial – Copying a File

In a previous tutorial we already talked about renaming and removing a file. In this C programming language tutorial we look at how to copy a file.

Let’s look at an example: More »


Posted in C Tutorials | 2 Comments


C Tutorial – Command Line Parameter Parsing

In this tutorial we take another look at command line parameter parsing with C programs. In a previous command line parameter tutorial we already looked at some simple command line argument parsing example. Please read that tutorial before advancing below. More »


Posted in C Tutorials | 2 Comments