FoodForFutureGeeks

Sunday 1 April 2012

Introduction to C


C language is one of the earliest & most used, high level programming languages, it was invented by Dennis Ritchie in AT&T Bell labarotaries USA in between 1969&1973.Originally it was designed to create system software on Unix platform, but today apart from being widely used in system software programming, C is also used to build portable applications.
DennisRitchie inventor of C


Dennis Ritchie Supervising coding on old Unix Systems

Sailient Features of C:

  •  Structured Programming language:
The program is compiled by the compiler from top to bottom, the program should be well structured(read article structure of a C program for more details).

  •  High level programming language:
Programming languages are of three types:
  1. Machine level programming, here programming is done in terms of only 0's and 1's.
  2. Assembly level programming,here programming is done by using short instructions 
ex:  add r0,r1,r2
  1. High Level Programming, here the program consists of instructions almost similar to english language.
ex: printf("hello");

  •  Procedure based programming language:
It supports divison of the complex program into individual procedures or modules, each procedure is responsible for carrying out its own task.

  • It is static:
The variables are assigned memory during the time of compilation, the procedure calls are resolved during compile time only.

  • Has well defined Keywords:
Keywords are those words which have a pre defined meaning, this cannot be changed by the programmer.
ex:
printf, scanf, if etc they cannot be used as variable names by programmers.

  • Supports looping, conditional checks:
Loops are used to repeat an instruction or a given set of instructions for a fixed no of times, C supports the for loop, while loop, do while loop.(read article on looping for more details.)
ex.....
for(int i=0;i<5;i++)
printf("this loop prints the statement 5 times");

Conditional checks are used to verify the validity of a particular condition.(read the article on conditional instructions for more details.
ex:
if(x>0)  
.....do something.......


No comments:

Post a Comment