Content of this Post:
- Introduction to C
- History of C
- Features of C
- Introduction to Programming
- Components of C programing
- Structure of C
.
Introduction to C:
What is C?
. C is a Computer Programming Language. It means , you can use C to create set of instructions that a computer can follow. C is probably the most popular language. C is a widely used programming language. C has won widespread acceptance because it gives programmers maximum control and efficiency. C is an easy language to learn. C is called as a compiled language.
.
History of C:
. C was developed at Bell Telephone Laboratories by Dennis Ritchie in the year 1970. C is the result two earlier languages called BCPL and B, Which were also developed at Bell Laboratories.
. Until 1978 C was restricted to use within Bell Laboratories. Later many computer professionals got impressed with the features of C and begun to use the language. My mid of 1980’s the popularity of C became widespread by a book written by Dennis Ritchie and Brain Kernighan. Many commercial software products were rewritten in C in-order to take its efficiency and its portability.
. ANSI, American National Standard Institute, developed a standardized version of C. C was invented to develop UNIX operating system.
.
Features of C:
C is a structured programming language:
C program has a specific structure, using which you can write programs.
C is very simple and easy to use:
C has got simple instructions and certain keywords. This makes our programming easier.
C encourages modularity:
C programs are written in modules. Modules are nothing but small set code performing a task. When a program is complex we split the program into modules , each performing a specific task.
C is highly portable:
In ‘C’ program written for one machine can be run on another machine without any or slight modification. C programs can be executed irrespective of the hardware environment.
C is case sensitive:
C is case sensitive, use lower-case for keywords and for the built-in functions.
C is an intermediate language:
All programming languages can be classified into two categories.
.
High-level language or program level language: |
These are the languages, which are developed for the application programs to perform efficiently. |
Low-level language or machine level language: |
These are the languages, which are developed for the application machines to perform efficiently. |
. C is neither a high-level language nor a low-level language. It is middle level language. Using ‘C’, we can write both system programs and application programs, which is not possible in most of the high level language.
.
Steps involved in executing a C program:
In order to run the program need to go through several stages. They are
- Type the text of the program into the computer
- Translate the program text into form the computer can use
- Run the translated program
.
Source program:
The text of a program is known the source program. It is in the human readable form
.
Compilation:
The translation of the source program into machine code is known as compilation. It is performing by a special program known as a compiler.
.
Components Of C Program:
The following are the components of the C program.
Header File:
The header file consists of all the library functions. So the appropriate header file should be included in any C program.
.
Function:
Any C program should contain at-least one function (main). The execution of program starts from the main function.
.
Delimiters:
The delimiters are used to mark the beginning and the end of the program. It can also be used to mark the beginning and end of a statement block (set of statements). The symbol for delimiters is ‘{‘ and ‘}‘.
.
Statements:
Each line in a program is a statement.
.
Keywords:
Keywords are otherwise called as reserved words. They have predefined meaning in C. Keywords are used for specific purposes.
.
Comment Entry:
While writing a C program, Explanation about each and every program statements can be enclosed between /* and */. The comment statements are include in the program, so as to enable the user or anyone to easily understand the code. The statements between the symbol /* and */ are not compiled.
For example
/*This is a sample program*/(this is a comment about a program)
.
Structure of C:
- Every C program must contain one or more functions. There should be at-least one function called main( ). The execution of the C program starts with main( ). The other functions can either follow or precede main( ) function.
- The statements within any function should be enclosed within the pair of braces{ }.
The opening brace ({ ) of the main( ) function indicates the starting of the program. The closing brace ( }) of the main( ) function indicates the closing of the program. The execution of the program stops on the occurrence of the closing brace of the main( ) function.