Q1: Write general structure of C program. OR Explain basic structure of c program. Also, notation for comments and meaning of comments. OR Write and Explain the structure of c program.

A1: The basic structure of C program is as follow:


Documentation Section: It includes basic details of this program in comments.

Link Section: It includes header files from the library files e.g. #include<stdio.h>.

Definition Section: It includes define constant like #define PI 3.14.

Global Declaration Section: This section is used to declare global variables.

main() Section: It is the entry point of every C programs.

{

Declaration Section: Here we declare variables to be used in program.

Executable Section: Here we execute logic of the program.

}

Sub-program Section: This section contains all the user define function.

function1()

{ function1() body}

function2()

{ function2() body}

 

 There are two types of comments in C Language:

Single line comment starts with ‘//’.

Multi line comment start with ‘/*’ and end with ‘*/’.

Post a Comment

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