C Reference Alphanumeric Test: isalnum()

The function isalnum() returns a non-zero if its argument is a letter of the alphabet or a numeric digit. If it is not letter of the alphabet or a numeric digit, then zero is returned.

isalnum() source code example:

More »


Posted in C Reference ctype.h Functions | Comments Off on C Reference Alphanumeric Test: isalnum()


Writing Memory to a File and Reading Memory from a File in C

In this C programming language tutorial we will look at how to save content from an allocated piece of memory to a (binary) file. We also read it back from a (binary) file into memory and display the content.

Because the program example is longer than the usual examples that we use in our tutorials, we’ve split it into parts. Further down you’ll find an explanation for each part of the source. More »


Posted in C Tutorials | 3 Comments


How to use Time and Date in C

In today’s C programming language tutorial we take a look at how to use time and date from C programs.
To make use of time and date function you need to include the time.h header file from the standard C library.

This header file contains functions and macros that provide standardized access to time and date. It also contains functions to manipulate and format the time and date output. The time.h reference page contains more information about the different time and date functions.

More »


Posted in C Tutorials | 46 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


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 – 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 – 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 – 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 – 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 – 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