Overveiw of C | C Programming


Couple using laptop
OVERVIEW OF C

History of C

  1. C was developed by Dennies Ritchie in 1972 by evolving ALGOL, BCPL and B.
  2. 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.
  3. Late on C++ and JAVA were developed from C.


Advantages of C

  1. Programs written in C are fast and efficient.
  2. C is highly potable. It means a program written on one system can be run on another system with little or no modification. 
  3.  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.
  4. 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.


C programming
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.

Programing style

  1. All statements must be in lowercase letters. Uppercase letters are used only for symbolic constants.
  2. Braces mark the starting and end of the program. They must be used properly.
  3. Judicial use of comments is advised.
  4. One can also write all statements in one line. But in this case, it's difficult to understand.
eg: a=b;
      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:
  1. Creating the program
  2. Compiling the program
  3. Linking the functions that are needed from C library
  4. Executing the program


           





   



Post a Comment

0 Comments