Smile

Sunday, May 29, 2011

Structure of C program


Document Section

This section is used to write comment lines for describing program or part of the program. This section will not be executed. This is an optional section.
Example
//Program for finding prime numbers from 1 to 100
/*Program for finding number is even or odd*/

Pre-Processor Section or Link Section

This section is used to include predefined or user-defined header files to the present program.
Example
#include<stdio.h>

Global Declaration Section
This section is used to declare the global data (which can be used through out the program). This is also an optional section.

Main programming section
This section is the heart of C program. With out this section the program will not run.

SubProgramming Section
This section is used to represent the user defined functions which will be explained later.

Tuesday, May 17, 2011

Block Diagram of Execution of ‘C’ program


























The compilation and execution process of C can be divided in to multiple steps:
  • Preprocessing - Using a Preprocessor program to convert C source code in expanded source code. "#includes" and "#defines" statements will be processed and replaced actually source codes in this step.
  • Compilation - Using a Compiler program to convert C expanded source to assembly source code.
  • Assembly - Using a Assembler program to convert assembly source code to object code.
  • Linking - Using a Linker program to convert object code to executable code. Multiple units of object codes are linked to together in this step.
  • Loading - Using a Loader program to load the executable code into CPU for execution.

Thursday, April 28, 2011

Features of C programming

  • n‘C’ is structured programming language with fundamental flow controlled construction.
  • n‘C’ is a simple and versatile language.
  • n Programs written in ‘C’ are efficient and fast.
  • n‘C’ has only 32 keywords.
  • n‘C’ has rich set of operators.
  • n‘C’ permits all data conversions and mixed mode operations.
  • nDynamic memory allocations is possible with ‘C’.
  • n‘C’ easily manipulates with bytes, bits and addresses
  • nExtensive varieties of data types such and arrays, pointers, structures, unions and registers are available.
  • ‘C’ improves by itself several built-in-functions and standard functions are available.
  • nRecursive function calls for algorithm approach is possible with ‘C’.
  • n‘C’ compiler combines probabilities of an assembly level language with features of high level language. So, it is called as middle level language.

Thursday, April 21, 2011

C Programming History

HISTORY
n 1.‘C’ programming was introduced in the year 1972 by Dennis Ritchie at AT&T (American Telephone and Telegraphs)Bellabs in USA.
n
n 2. In 1960’s COBOL was being used for commercial apps and FORTRAN for scientific and engineering apps.
n
n 3. At that stage they used to develop a language which is suitable for all apps.
n
n 4. ALGOL60 was released but it was not popular because it seems too general.
n
5. To reduce the generality a new language called
CPL(Combined Programming Language) developed at Cambridge University.
n
n6. After some features are added to this language and a new language called BCPL(Basic CPL) was developed by Martin Richards.
n
n7. The ‘B’ language was developed by Ken Thomson at AT&T Bellabs.

n8. Dennis Ritchie inherited features of B & BCPL and added some of his features developed ‘C’ language in 1972.