Ques : C Program Structure

, , No Comments

 As we have already seen, to solve a problem there are three main things to be taken

into consideration. Firstly, what should be the output? Secondly, what should be the
inputs that will be required to produce this output? Thirdly, the steps of instructions
which may be used for these inputs to produce the required output. As stated earlier,
every programming language follows a set of rules; therefore, a program written in C
also follows predefined rules known as syntax. C is a case sensitive language. All C
programs consist of one or more functions. One function that must be present in every
C program is main (). This is the first function called up when the program execution
begins. Basically, main() outlines what a program does. Although main is not given
in the keyword list, it cannot be used for naming a variable. The structure of a C
program is illustrated in Figure1 where functions func1 ( ) through funcn ( ) represent
user defined functions.

Preprocessor directives
Global data declarations
main ( ) /* main function/ { Declaration part; Program statements; } /User defined functions*/
func1( )
{
…………
}
func2 ( )
{
…………
}
.
.
.
funcn ( )
{
…………
}

0 टिप्पणियाँ:

Post a Comment