C Language was originally developed at Bell Labs by Ken
Thompson and Dennis Ritchie in th mid of 1970’s. It is one of the most popular
procedural, general purpose, and high-level programming language used in all
operating systems of today. Although C was designed for writing system
software, it is also widely used for developing application software. C is one
of the most popular programming languages of all the time and there are very
few computer architectures for which a C compiler does not exist.
C has greatly influenced many other popular programming
languages, most notably C++, which began as an extention to C. C supports
different types of statements like sequential, selection, looping etc.
Procedural programming concept is well supported in C, this helps in dividing
the programs into function modules or code blocks.
Structure of C program:
Structure of a c program cosists of following parts:
document Section
link section
defination section
global declaration section
main()
{
}
Sub-program Section
function()
{
}
function2()
{
}
…
The document section consists of a set of comment lines
giving the name of the program, the author and other details such as short
description of the purpose of the program etc. The link section provides
instructions to the compiler to link functions from the system library. The
defination section defines all the symbolic constants.
The variables can be declared inside the main function or
before the main function. Declaring the variables before the main function
makes the variables accessible to all the functions in a C language program,
such variables are called Global
Varialbes. Declaring the variables within main function or other
functions makes the usage of the variables confined to the function only and
not accessible outside. These variables are called Local Variables.
Every C program must have one main function. It contains
different executable statements between the opening and closing braces. The
sub-program section contains all the user-defined functions that are called in
other main function. User-defined functions are generally placed immediately
after the main function although they may appear in any order.
No comments:
Post a Comment