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

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


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 make a Calendar in C

In the C tutorial “How to use Time and Date in C” some people asked questions in the comment section about determining dates and day of the week. That’s why we created this tutorial to show you what things you have to lookout for, such as leap years. More »


Posted in C Tutorials | 32 Comments


C Tutorial – Searching for Strings in a Text File

In this C language tutorial we will show you how to search for a string in a text files. We will make use of command-line input, fopen or fopen_c and system to clear the screen. Make sure that you have read and understand the following tutorial C tutorial File I/O using Text Files before you continue this one. Add the end of the tutorial you can download the source code of this tutorial.

We start this C language tutorial with some include statements. To make use of strings in your program you need to make sure that you include the header file string.h
More »


Posted in C Tutorials | 13 Comments


C Tutorial – Number of Seconds in Decade and Visa-Versa

In a previous C language tutorial post the user “nikko manlangit” asked the following question: “How to convert seconds to decade or vice-versa?”. This C tutorial make use of time.h functions to answer his question. More »


Posted in C Tutorials | Comments Off on C Tutorial – Number of Seconds in Decade and Visa-Versa


C Tutorial – A Star pyramid and String triangle using for loops

In this C language tutorial we will look at a much-requested subject, printing a star pyramid and a string triangle using for loops.

We know that this question is often asked as part of homework (lab) assignments, but we got so much requests that we couldn’t ignore it. BUT we are urging you to at least try to make the homework questions yourself! At the end of this tutorial we will give two alternative questions, so you can try to fix those yourself. More »


Posted in C Tutorials | 30 Comments


C Tutorial – Call by Value or Call by Reference

In this C language tutorial we will take a look at call by value and call by reference (also known as pass-by-value and pass-by-reference). These methods are different ways of passing (or calling) data to functions. More »


Posted in C Tutorials | 101 Comments


C Tutorial – Deleting a Record from a Binary File

In this C language tutorial we will build upon a previous C tutorial (Binary File I/O) where we took a quick look add binary file IO. In this tutorial we will take a look at how to delete a certain record (found by name) from a binary file and how to read/write a record(s) from or to a binary file. So let’s start! More »


Posted in C Tutorials | 1 Comment


C Tutorial – Splitting a Text File into Multiple Files

A new year (have a good new year by the way) a new C language tutorial. We start the year with a C language tutorial where we will look at how to split a text file into multiple files. In previous tutorials we already looked at reading and writing text files in C examples and searching in text files, so in this tutorial we will build on these tutorials. More »


Posted in C Tutorials | 4 Comments


C Tutorial – Error Handling (Exception Handling)

In this C language tutorial we are going to look at error handling. Although C programming does not provide direct support for error handling (also called exception handling), there are ways to do error handling.

Of course the programmer needs to prevent errors during coding and should always test the return values of functions called by the program. A lot of C function calls return a -1 or NULL in case of an error, so quick test on these return values are easily done with for instance an ‘if statement’. More »


Posted in C Tutorials | 2 Comments