C (programming language)

general-purpose programming language

The C programming language is a low-level (close to the computer) computer programming language that was developed to do system programming for the operating system UNIX and is an imperative programming language. C was developed in the early 1970s by Ken Thompson and Dennis Ritchie at Bell Labs. It is a procedural language, which means that people can write their programs as a series of step-by-step instructions. C is a compiled language. This means that the computer doesn't have to build the application every time it is opened.

C programming language logo

Because the ideas behind C are kept close to the design of the computer, the compiler (program builder) can generate machine code/native code for the computer. Programs built in machine code can be very fast. C has a variety of uses. From writing simple console applications, to even operating systems, such as Linux, MacOS and UNIX. The language itself has very few keywords, and most things are done using libraries, which are collections of code made to be reused. C has a big standard library called stdio, which stands for standard input/output.

C standardsEdit

There are three successive standards for the C programming language ANSI C, ISO C and Standard C which are published by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO).

C is available for many different types of computers. This is why C is called a "portable" language. A program that is written in C and that respects certain limitations can be compiled for most platforms, and all in mainstream use.

The syntax of C has also influenced many other programming languages, such as C++, C#, and Java, and many more programming languages we use nowadays.

Example codeEdit

Here is an example of a program written in C. When built and run it will show "Hello world!", followed by a new line on the computer screen.

#include <stdio.h>

int main() {
    printf("Hello world!\n");
    return 0;
}
  • #include <stdio.h> gets the standard input/output tools ready for the program to use. This allows text to be displayed (output).
  • int main() is called the main function, and it is where the first code starts being run in a C program.
  • printf("Hello world!\n"); is what displays text, in this case "Hello world!" with a new line (\n) at the end.
  • return 0; tells the computer that the program finished and did not run into problems.

Related pagesEdit

Other websitesEdit