0% found this document useful (0 votes)
7 views2 pages

Structure of C Program

The structure of a C program includes preprocessor directives, the main function, and the program body. The main function is essential for execution, and it begins with 'void' indicating no return value and accepts no arguments. C statements are instructions enclosed in curly brackets and must end with a semicolon.

Uploaded by

aslamsaira437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Structure of C Program

The structure of a C program includes preprocessor directives, the main function, and the program body. The main function is essential for execution, and it begins with 'void' indicating no return value and accepts no arguments. C statements are instructions enclosed in curly brackets and must end with a semicolon.

Uploaded by

aslamsaira437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

STRUCTURE OF C PROGRAM:

The format of writing c program is called its structure.The basic structure of


c program is very flexible.It increases the power of the language.It consist
of following parts:
Preprocessor directive
Main function()
Program body
Example:
#include<stdio.h>
Void main()
{
Printf(“HELLO WORLD”);
}
PREPROCESSOR DIRECTIVE:
Preprocessor directive is an instruction given to the compiler before the
execution of actual program.preprocessor directive is also known as
compiler directive.The preprocessor directives is also known as
preprocessor.

MAIN FUNCTION:
The main function is the place where the execution of a c program
starts.when the program is executed,the control enters main function().If a
program does not contain main function,it can be compiled but cannot be
executed.

Any number of statements can be written in the body of the main()


function.The body is enclosed braces{ }.

SYNTAX:
Void main()

Body of main function


}

1) The definition of main function starts with keywors void.It


indicates the tyoe of value that is returned by function.Void
means that the function will return no value.
2) Keyword void in parenthesis indicates that function does not
accept any argument.
3) The body of main function is enclosed in braces.It consist of c
language statements.The instructions are used to implement
program logic.
PROGRAM BODY(C STATEMENT):
A statement in c language is an instruction for the computer to
perform a task.The statements are written in curley
brackets.Computer perform these instructions one by one in c is
terminated with semicolon.
EXAMPLE:
#include<stdio.h>
Void main()
{
Printf(“HELLO WORLD OF C PROGRAMMING”);
Printf(“PROGRAMMING MAKES LIFE INTERESTING”);
}
END

You might also like