Structure of C program, C language Assignment Help

Assignment Help: >> Introduction to C language >> Structure of C program, C language

Structure of C program

 # include<header file>

global variable

main ( )

{

declaring and initializing variables;

statement1 ;

statement2 ;

............... ;

............... ;

}

 Any C program consists of one or more distinct units called "functions". These functions consist of valid C statements and are linked together through "function calls". Every function in a program has a unique name and is designed to perform a specific task. Functions in C language can be placed anywhere in the program. The general form of a C program:

void main ()

{

                //declaration of variables;

                //instructions or statements;

}

 

1.       void main (): This line of the program is the point at which working of the program begins. Every C program must have this line at the beginning of the program.

2.       {}: Next, comes the left curly brace '{'. This is matched by the right curly brace '}' at the end of the program. This curly brace contains statements.

3.       The initial statements in the body of the program are the declaration of the variables. All the variables have to be declared before they are used in the program.

4.       The statements that follow the declaration of variables specify precisely what actions a particular program has to perform.

5.       In C, all statements within the braces should end with a semicolon ';'.

6.       A C program is a collection of one or more functions. A pair of parentheses always follows a function name. For ex: main (), printf (), etc.

7.       The group of statements within a program or a function body is executed sequentially, so these statements must appear in the same order in which we wish them to be executed.

8.       If the closing brace '}' of the main () is reached, it indicates the end of program and the program execution stops at this point and the control is handed over to the Operating System.

9.       Usually all C statements are entered in small case letters. C is case sensitive language.

10.   C has no specific rules about the position at which different parts of a statement are to be written. Not only can a C statement be written anywhere in the line, it can also be split over multiple lines. Thus C is free form language.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd