google.com, pub-8786015629279405, DIRECT, f08c47fec0942fa0 Structure of C Language program

Structure of C Language program

0
Structure of C Language program


1 ) Comment line 

2) Preprocessor directive 

3 ) Global variable declaration 

4) main function( ) 

 { 

 Local variables; 

 Statements; 

 } 

 User defined function 

 } 


Comment line 

It indicates the purpose of the program. It is represented as 

/*……………………………..*/ 

Comment line is used for increasing the readability of the program. It is useful in explaining the program and generally used for documentation. It is enclosed within the decimeters. Comment line can be single or multiple line but should not be nested. It can be anywhere in the program except inside string constant & character constant. 

Pre processor Directive:

#include tells the compiler to include information about the standard input/output library. It is also used in symbolic constant such as #define PI 3.14(value). The stdio.h (standard input output header file) contains definition &declaration of system defined function such as printf( ), scanf( ), pow( ) etc. Generally printf() function used to display and scanf() function used to read value.

Global Declaration: 

This is the section where variable are declared globally so that it can be access by all the functions used in the program. And it is generally declared outside the function :  

main() 

It is the user defined function and every function has one main() function from where actually program is started and it is encloses within the pair of curly braces. 

The main( ) function can be anywhere in the program but in general practice it is placed in the first position. 

Syntax : 

 main() 

{ …….. 

…….. 

…….. 


The main( ) function return value when it declared by data type as 

 int main( ) 


return 0

 } 

The main function does not return any value when void (means null/empty) as 

void main(void ) or void main() 


 printf (“C language”); 


Output: C language The program execution start with opening braces and end with closing brace. And in between the two braces declaration part as well as executable part is mentioned. And at the end of each line, the semi-colon is given which indicates statement termination. 

/*First c program with return statement*/ 

#include int main (void) 


printf ("welcome to c Programming language.\n"); 

return 0; 


Output: welcome to c programming language. 

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Thank you for your interest 😊

We will back shortly after reviewing...

Thank you for your interest 😊

We will back shortly after reviewing...

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top