C Tutorial – for loop, while loop, break and continue

In every programming language, thus also in the C programming language, there are circumstances were you want to do the same thing many times. For instance you want to print the same words ten times. You could type ten printf function, but it is easier to use a loop. The only thing you have to do is to setup a loop that execute the same printf function ten times. More »


Posted in C Tutorials | 94 Comments


C Tutorial – The if and switch statement

In this C programming language tutorial we take a look at the “if statement” and “switch statement”. Both are used to alter the flow of a program if a specified test condition is true.

Boolean Operators

Before we can take a look at test conditions we have to know what Boolean operators are. They are called Boolean operators because they give you either true or false when you use them to test a condition. The greater than sign “>”
for instance is a Boolean operator. More »


Posted in C Tutorials | 25 Comments


C Tutorial – variables and constants

In this C programming language tutorial we take a look at variables and constants.

Variables

If you declare a variable in C (later on we talk about how to do this), you ask the operating system for a piece of memory. This piece of memory you give a name and you can store something in that piece of memory (for later use). There are two basic kinds of variables in C which are numeric and character. More »


Posted in C Tutorials | 43 Comments


First C program, Hello World

After talking about the history and compilers it is time to make our first program. We like to make C programs under Linux, so we will use a text editor and the gnu compiler. But all programs we make in these tutorials will also work under Windows. Remember, the examples included in the C and C++ tutorials are all console programs. That means they use text to communicate. All compilers support the compilation of console programs. Check the user’s manual of your compiler for more info on how to compile them. (It is not doable for us to write this down for every compiler). More »


Posted in C Tutorials | 52 Comments


C Tutorial – Compilers (GNU and Visual Studio)

A compiler is a program that translates one language (high level) into another language (e.g., assembly language or machine specific language). A compiler translates source code (plain text) into object code (normally in a form suitable for processing by other programs (like a linker)). The most common reason for wanting to translate source code is to create an executable program.

After the compiler translates the source code in object code, the object(‘s) have to be linked into an executable. This is done by a program called a linker (in most cases the compile stage and link stage are done automatically. It is also possible to do these stages separately). More »


Posted in C Tutorials | 7 Comments


The History of the C Language

The C programming language was devised in the early 1970s by Dennis M. Ritchie an employee from Bell Labs (AT&T).

In the 1960s Ritchie worked, with several other employees of Bell Labs (AT&T), on a project called Multics. The goal of the project was to develop an operating system for a large computer that could be used by a thousand users. In 1969 AT&T (Bell Labs) withdrew from the project, because the project could not produce an economically useful system. So the employees of Bell Labs (AT&T) had to search for another project to work on (mainly Dennis M. Ritchie and Ken Thompson).

More »


Posted in C Tutorials | 55 Comments