13-06-2012, 03:58 PM
C LANGUAGE
c lang.docx (Size: 90.56 KB / Downloads: 93)
INTRODUCTION TO ‘C’
The Basic Combined Programming Language (BCPL) called B is developed in 1960’s at Cambridge University. This B language was modified and implemented with a new name ‘c’ by Dennis Ritchie at Bell Laboratories in 1972. It is strongly associated with Unix Operating System. But today c is running under a number of operating systems including MS-DOS. We have different types of c compilers as ANSIC, Turbo c, UNIX C and so on.
IMPORTANCE OF C:
C is a small core language; there are surprisingly few keywords to learn. And it is very is richer in built in functions and operators can be used to write any complex programs.
The c combines the capabilities of am assembly language with the features of a high level language. So it is well suited for writing both system software and business packages.
C language is well suited for structured programming. We divide the program code into some modern A proper collection of there modules would make a complete program and it a very easy in debugging, testing, and maintenance.
1. The structure of c programs
Documentation section
Linkage section
Global declaration section
Main function section
Main ()
{
Local declarations part
Executable part;
}
Sub programs section
Function1 (argument list)
Declaration of argument list
{
Local declarations part;
Executable part;
}
Documentation section:-
This section consists of a set of comment lines about the name of program, author name and other details. Every comment line starts with /* and ends with */. Any thing written between these symbols is called are an aid to the programmer to read and understand the program.
Linkage section:-
This section provides instructions to the compiler to link functions from the system library. For example #include<stdio.h>
This is called a preprocessor directive.
Definition section:-
This section defines all symbolic constants. Using #define directive ‘c’ allows us to define an identifier as having a constant value. It is also called a preprocessor directive. It is not a part of c program. No semicolon follows
GLOBAL DECLARATION SECTION:-
This section contains the variables which are used in more than one function. This section must be outside of all the functions.
Main function section:-
This section must have a main () function. The function main () has a unique role to play in all c programs. Sequences of functions. You may wonder which one fires up first. To overcome this problem, a special function main () is designed. So, c program must have one main () function exactly somewhere and this is where c starts off when executing the compiled code.
Subprograms:-
This section contains all the user defined functions that are called in the main function. These are placed generally immediately after the main function. The functions are the heart and soul of c.
2. Data, Data types:-
The primary purpose of any computer is the manipulation of information or data. This data is, actually the collection of digits, characters or both.
The data types specify the type of collection of data. The collection of digits is called numerical data. The collection of different characters is called non-numerical data.
The non-numerical data, generally, the collection of alphabets.