Knowledge Base
Home > Learn Programming > Learn C/C++ Programming

What is C?


C is a programming language invented in the early 1970s by Dennis Ritchie as a language for writing operating systems.

The purpose of C is to precisely define a series of operations that a computer can perform to accomplish a task. Most of these operations involve manipulating numbers and text, but anything that the computer can physically do can be programmed in C.

Computers have no intelligence- they have to be told exactly what to do and this is defined by the programming language you use. Once programmed they can repeat the steps as many times as you wish at very high speed. Modern PCs are so fast they can count to a billion in a second or two.

What can a C program do?
Typical programming tasks includes putting data into a database or pulling it out, displaying high speed graphics in a game or video, controlling electronic devices attached to the PC or even playing music and/or sound effects.You can even write software to generate music or help you compose.

Is C the best programming language?
Some computer languages were written for a specific purpose. Java was originally devised to control toasters, C for programming Operating Systems, Pascal to teach good programming techniques but C was intended to be more like a high level assembly language which could be used to port applications to different computer systems.

There are some tasks that can be done in C but not very easily, for example designing GUI screens for applications. Other languages like Visual Basic, Delphi and more recently C# have GUI design elements built in to them and so are better suited for this type of task. Also some scripting languages that provide extra programmability to applications like MS Word and even Photoshop tend to be done in variants of Basic, not C.You can find out more about the other computer languages and how they stack up against C.

Which computers have C?
This is better stated as which computers don't have C! The answer- almost none, after 30 years of use it is everywhere. It is particularly useful im embedded systems with limited amounts of RAM and ROM. There are C compilers for just about every type of operating system. Find out more about Operating Systems.

How do I get started with C?
First you need a C compiler. There are many commercial and free ones available. The list below has instructions for downloading and installing the compilers. Both are completely free and include an IDE to make life easier for you to edit, compile and debug your applications.

* Download and Install Microsoft's Visual C++ 2005 Express Edition
* Download and Install Open Watcom C/C++ Compiler

The instructions also show you how to enter and compile your first C application.

How do I begin writing C applications?
C code is written using a text editor. This can be notepad or an IDE like those supplied with the three compilers listed above. You write a computer program as a series of instructions (called statements) in a notation that looks a little like mathematical formulas.

int c=0;
float b= c*3.4+10;

This is saved out in a text file and then compiled and linked to generate machine code which you then can run. Every application you use on a computer will have been written and compiled like this, and many of them will be wriiten in C. Read more about compilers and how they work. You can't usually get hold of the original source code unless it was open source.

Is there plenty of C Open Source?
Because it is so widespread, much open source software has been written in C. Unlike commercial applications, where the source code is owned by a business and never made available, open source code can be viewed and used by anyone. It's an excellent way to learn coding techniques. You can see many examples in the C Code Library

Could I get a programming job?
Certainly. There are many C jobs out there and an immense body of code exists that will need updating, maintaining and occasionally rewriting. The top three most popular programming languages according to the quarterly Tiobe.com survey, are Java, C and C++.

You could write your own games but you'll need to be artistic or have an artist friend. You'll also need music and sound effects. Find out more about game development. Games like Quake 2 and 3 were written in C and the code is available free online for you to study and learn from it.

Perhaps a professional 9-5 career would suit you better- read about a professional career or perhaps consider entering the world of software engineering writing software to control nuclear reactors, aircraft, space rockets or for other safety critical areas.

What Tools and Utilities are there?
Well if you can't find what you want, you could always write it. That is how most of the tools around came into existence. We've listed some tools and utilities but keep checking back.


Year of Creation ?
1968 to 1973. C is the oldest of the three languages in this topic and according to the Tiobe.com language comparison, C is still the second most popular language, just behind Java. This is largely due to the number of Unix/Linux systems in existence where C reigns supreme. On Windows, C++ is more popular.

Why was C Invented?
The design goals of C were to provide a simple procedural language for programming Operating Systems, with direct access to memory, a small library, efficient execution and reasonably portability; certainly more so than Assembly Language. It encouraged Structured Programming- a philosophy popular in the 70s where large applications were divided into smaller more manageable pieces.
What was C used for?: One of the earliest applications written in C was Unix. Prior to this, many Operating Systems, including Unix had been written in Assembly Language which restricted their portability.

What Versions of C are there?
The first version of C was K&R C named after Dennis Ritchie (who invented C) and Brian Kernighan. This was later superceded by Ansi C in 1990. K&R C was a little loose in checking types and parameters of functions and that could lead to unpredictable results and program failures. Because these could lead to memory being overwritten, it was possible for programs to crash the computer they were running on.
Is C Still being Developed?: Several new features were introduced in 1999 - inline functions (like C++), variable length arrays and new types like long long int for 64 bit CPUs but not all compilers support these yet.

Does C present any problems for novice Programmers?
For professional development, maintainability is essential. it is possible to write extremely obtuse code in C. There is even an annual contest for the most Obfuscated code at http://ioccc.org

C has some inconsistencies in syntax. E.g. Pointers and arrays - Pointers are prefixed with a * like *x while arrays are postfixed with [] eg u[]. This simplifies the task of writing confusing code.
How would You sum up C?: C is a powerful programming language, and one of the most popular but it can bite the novice. It is well worth the study as it is arguably the root (syntactically) of many other procedural languages. Learn C and you've learnt the syntax of half a dozen others.

What is C++?


C++ is a general purpose programming language invented in the early 1980s by Bjarne Stroustrup at Bell Labs. It is similar to C, invented in the early 1970s by Dennis Ritchie, but is a safer language than C and includes modern programming techniques such as object oriented programming.

You can read more about object oriented programming. In fact C++ was originally called C with Classes and is so compatible with C that it will probably compile more than 99% of C programs without changing a line of source code. This was a deliberate design feature by the designer. Here is a short overview and history of C++.

The purpose of C++ is to precisely define a series of operations that a computer can perform to accomplish a task.

Most of these operations involve manipulating numbers and text, but anything that the computer can physically do can be programmed in C++. Computers have no intelligence- they have to be told exactly what to do and this is defined by the programming language you use. Once programmed they can repeat the steps as many times as you wish at very high speed. Modern PCs are so fast they can count to a billion in a second or two.

What can a C++ program do?
Typical programming tasks includes putting data into a database or pulling it out, displaying high speed graphics in a game or video, controlling electronic devices attached to the PC or even playing music and/or sound effects. You can even write software to generate music or help you compose.

Is C++ the best programming language?
Some computer languages were written for a specific purpose. Java was originally devised to control toasters, C for programming Operating Systems, Pascal to teach good programming techniques but C++ is a general purpose language and well deserves the "Swiss Pocket Knife of Languages" nickname. There are some tasks that can be done in C++ but not very easily, for example designing GUI screens for applications. Other languages like Visual Basic, Delphi and more recently C# have GUI design elements built in to them and so are better suited for this type of task. Also some scripting languages that provide extra programmability to applications like MS Word and even Photoshop tend to be done in variants of Basic, not C++.

You can find out more about the other computer languages and how they stack up against C++.

Which computers have C++?
This is better stated as which computers don't have C++! The answer- almost none, it is so widespread. It is a nearly universal programming language and can be found on most microcomputers, and all the way up to big computers costing millions of dollars. There are C++ compilers for just about every type of operating system. Find out more about Operating Systems.

How do I get started with C++?
First you need a C++ compiler. There are many commercial and free ones available. The list below has instructions for downloading and installing each of the compilers. All three are completely free and include an IDE to make life easier for you to edit, compile and debug your applications.

* Download and Install Borland's Turbo C++ Explorer
* Download and Install Microsoft's Visual C++ 2005 Express Edition
* Download and Install Open Watcom C/C++ Compiler

The instructions also show you how to enter and compile your first C++ application.

How do I begin writing C++ applications?
C++ is written using a text editor. This can be notepad or an IDE like those supplied with the three compilers listed above. You write a computer program as a series of instructions (called statements) in a notation that looks a little like mathematical formulas.

int c=0;
float b= c*3.4+10;

This is saved out in a text file and then compiled and linked to generate machine code which you then can run. Every application you use on a computer will have been written and compiled like this, and many of them will be written in C++. Read more about compilers and how they work. You can't usually get hold of the original source code unless it was open source.

Is there plenty of C++ Open Source?
Because it is so widespread, much open source software has been written in C++. Unlike commercial applications, where the source code is owned by a business and never made available, open source code can be viewed and used by anyone. It's an excellent way to learn coding techniques. You can see many examples in the C++ Code Library

Could I get a programming job?
Certainly. There are many C++ jobs out there and an immense body of code exists that will need updating, maintaining and occasionally rewriting. The top three most popular programming languages according to the quarterly Tiobe.com survey, are Java, C and C++.

You could write your own games but you'll need to be artistic or have an artist friend. You'll also need music and sound effects. Find out more about game development. Perhaps a professional 9-5 career would suit you better- read about a professional career or perhaps consider entering the world of software engineering writing software to control nuclear reactors, aircraft, space rockets or for other safety critical areas.

What Tools and Utilities are there?
Well if you can't find what you want, you could always write it. That is how most of the tools around came into existence. We've listed some tools and utilities but keep checking back.