|
Page 1 of 2
C Programming Language - An Overview
In this tutorial you will learn about C Programming Lanuage, Overview of C, Sample program - Printing a message, Executing a C Program and Basic structure of C programs
Overview of C
C is a programming language. It is most popular computer language today because it is a structured high level, machine independent language. Programmers need not worry about the hardware platform where they will be implemented.
Dennis Ritchie invented C language. Ken Thompson created a language which was based upon a language known as BCPL and it was called as B. B language was created in 1970, basically for unix operating system Dennis Ritchie used ALGOL, BCPL and B as the basic reference language from which he created C.
C has many qualities which any programmer may desire. It contains the capability of assembly language with the features of high level language which can be used for creating software packages, system software etc. It supports the programmer with a rich set of built-in functions and operators. C is highly portable. C programs written on one computer can run on other computer without making any changes in the program. Structured programming concept is well supported in C, this helps in dividing the programs into function modules or code blocks.
Sample program-1
Printing a message
Consider the following message
|
.
#include
main()
{
...../* Printing begins here */
.....printf (“C is a very good programming language.”);
...../* Printing ends here */
}
.
|
The first line is a preprocessor command which adds the stdio header file into our program. Actually stdio stands for standard input out, this header file supports the input-output functions in a program.
In a program, we need to provide input data and display processed data on standard output – Screen. The stdio.h header file supports these two activities. There are many header files which will be discussed in future.
The second line main() tell the compiler that it is the starting point of the program, every program should essentially have the main function only once in the program. The opening and closing braces indicates the beginning and ending of the program. All the statements between these two braces form the function body. These statements are actually the C code which tells the computer to do something. Each statement is a instruction for the computer to perform specific task.
The /* .... */ is a comment and will not be executed, the compiler simply ignores this statement. These are essential since it enhances the readability and understandability of the program. It is a very good practice to include comments in all the programs to make the users understand what is being done in the program.
The next statement printf() statement is the only executable line in the above sample program. The printf() function is a standard inbuild function for printing a given line which appears inside the double quotes. Therefore in the standard output device we can see the following line
C is a very good programming language.
The next line is again a comment statement as explained earlier. The closing brace indicates the end of the program.
|