Search This Blog

Saturday, February 25, 2012

Introduction to C


Introduction to C


C is a general purpose high-level language developed by Dennis Ritchie and Brain Kernighan at AT&T Bell Laboratories of USA in 1972. Originally it was designed to run on a PDP-11 under UNIX operating system. C was influenced by two related languages BCPL and B. Although it was originally intended to run under UNIX, there has been a great interest in running it under MS-DOS on IBM-PC. Many high-level languages like Pascal are highly disciplined and structured. C is much more flexible and free-wheeling. This freedom gives C much more power that experienced users can employ.


C has been a popular language due to its simplicity of expression, the compactness of the code, extensive use of function calls and the wide range of applicability. C is cryptic in nature. It allows the programmer a wide range of operations from high-level up to low-level.

Structure of a C Program

A, C program basically has the following structure.

  • Pre-processor commands
  • Type definitions
  • Function prototypes
  • Variables
  • Functions


Saturday, February 18, 2012

Object Oriented Programming


Object Oriented Programming


Object Oriented Programming is a modern, popular approach to programming which transcends the different generations, and represents an approach and methodology which is becoming the norm rather than the exception.

C++ is the object oriented extension of the C language.

Note that C++ (which we use) incorporates C, meaning that it is possible to use OO languages to program in a procedural manner

In procedural programming, the main emphasis is on the tasks necessary to effect a solution to the problem - the data on which the procedures act is the secondary focus.

In object-oriented programming the emphasis is reversed with the data being of prime importance and the procedures that act on that data assuming secondary focus.

The OO approach is seen as essential as software projects become more complex.

Saturday, February 11, 2012

Structured Programming


Structured Programming


Structured programming can be seen as a subset or sub-discipline of Procedural programming, one of the major paradigms (and probably the most popular one) for programming computers. It is possible to do structured programming in almost any procedural programming language, but since about 1970 when structured programming began to gain popularity as a methodology, most new procedural programming languages have included features to encourage structured programming, (and sometimes have left out features that would make unstructured programming easy). Some of the better known structured programming languages are : Pascal, Ada At the level of relatively small pieces of code, structured programming typically recommends simple,
hierarchical program flow structures. These can be obtained in most modern languages by using only structured looping constructs, often named "while", "repeat", "for". Often it is recommended that each loop should only have one entry point and one exit point, and a few languages enforce this.

Friday, February 3, 2012

Procedural Programming


Procedural Programming


A procedure or function is a self-contained program module that executes a set of specific instructions. The procedural approach focuses on the procedures that must be enacted in order to solve a particular problem. Thus a program can be viewed as a sequence of procedure calls. A procedure calls another (calling procedure) for services. After the sequence of statements in the called procedure is processed, the flow of control continues right after the point where the call was made. A procedure also can call a sub-procedure and in any case, calling procedure and the called procedure are allowed to exchange data in some way. This form of programming has been in existence the longest, and is still in use today by many programmers.