OVERVIEW OF C |
History of C
- C was developed by Dennies Ritchie in 1972 by evolving ALGOL, BCPL and B.
- American National Standard Institute (ANSI) appointed a technical committee in 1986 to define a standard for C. Then approved version of C is today known as ANSI C.
- Late on C++ and JAVA were developed from C.
Advantages of C
- Programs written in C are fast and efficient.
- C is highly potable. It means a program written on one system can be run on another system with little or no modification.
- It is based on structured programming, thus requiring the users to think problems into module or block. The proper collection of these modules make a complete program. This makes debugging, testing and maintenance easier.
- C provides support to extends itself. A C program is basically a collection of Functions to the C library. We can add our library. With a large number of functions, the programming becomes simple.
The basic structure of the C program
Function: It is a subroutine that may include one or more statements designed to perform a specific task.
A C program may contain one or more parts as shown in the figure.
Overview of C Program |
Documentation Section consists of comment lines with details of the program, the author and other details which can be useful later.
The link Section provides the instructions to the compiler to link the functions from the system library.
The definition section defines all symbolic constants.
A global variable is a variable that is used in more than one function. It is declared in Global declaration section. This section also declares all user-defined functions.
Every C program must have main function section. This section has two parts declaration and execution. Declaration part is used to declare al the variables used in the execution part. There must be at least one statement in the execution part. Every statement ends with a semicolon(;). Execution of the program begins at opening curly braces and ends at closing curly braces.
A subprogram section contains all user-defined functions.
All sections, except the main function, can be absent when not needed.
Every C program must have main function section. This section has two parts declaration and execution. Declaration part is used to declare al the variables used in the execution part. There must be at least one statement in the execution part. Every statement ends with a semicolon(;). Execution of the program begins at opening curly braces and ends at closing curly braces.
A subprogram section contains all user-defined functions.
All sections, except the main function, can be absent when not needed.
Programing style
- All statements must be in lowercase letters. Uppercase letters are used only for symbolic constants.
- Braces mark the starting and end of the program. They must be used properly.
- Judicial use of comments is advised.
- One can also write all statements in one line. But in this case, it's difficult to understand.
x=y+1;
z=a+x;
In one line: a=b;x=y+1;z=a+x;
Executing a 'C' program
Execution of C program includes four main steps:
- Creating the program
- Compiling the program
- Linking the functions that are needed from C library
- Executing the program
0 Comments
Please do not send a spam message.