Structure of C Program

 A C program Contains one or more of the section as shown in the image



Documentation Section:
This section consists of set of comment lines with the information like name of the program, author and other information that can be referred later by  the programmer or others

Link Section:
Contains header files containing library functions that are required to execute a C Program.

Definition section:
Symbolic constants are declared using #define directive

Global declaration section:
Global Variables are declared in this section. The global variables can be used even outside main function.

main() function section:
Execution of a C program starts with the main() function. A C program should have only one main() function. This section start with '{'  and ends with '}'

This section has two parts:

  • Declaration part: The variables used in the program are declared in the section.
  • Executable part: This part contains the program code

Subprogram section: This section contains all the user-defined functions that can be called in the main() function. There can be zero or more subprograms.

BASIC STRUCTURE:
#include<stdio.h>
int main()
{
return 0;
}

#

 Directory

include

 should include this in the program

stdio.h

 Standard Input/Output header file

Iit

 datatype

main()

function name. It is the execution point of my program. i.e it is the place where my program begins.

{ } 

 Specifies a Block of code

return

It intimates to the compiler that the program has reached the end of the line

;

 Termination Statement











← Back Next →

Comments

Popular posts from this blog

Wrapper Class

Information Security & Essential Terminology

Information Security Threat Categories