Basic Structure of C Program

Basic Structure of C-Programing
Basic Structure of C-Programing


The format or way according to which a computer program is written is called the structure of the program. The program structure of different programming languages is different. C is a structured programming language. It provides a well-defined way of writing programs.
The basic structure of c program consists of the following main parts:

Processor directives
The main function
C statements
To explain the structure of c program, a program example that prints a message my first program In c is given below.
#include <stdio.h>
Void main (void)
{
Printf (“my first program in c”)
}
In the above program:
The header file stdio.h is used at the beginning of program. This file contains the declarations of standard input and output functions. These functions are used to get input and to print  output. This header file is include because printf fucntino is used in the main body of program to print the message “my first program in c”
The linke beginning with sign indicates that this is an instruction for the c-compiler. The commands that give instructions to the c-compiler are called preprocessor directive. The
#include<stdio.h> is an example of preprocessor directive.
The main function comes after the preprocessor directives. It indicates the beginning of the actual c program. It is the point at which execution of program is strated.
The set of statements of c program are written under the main() function between curly brackets i.e{}. Each statement of C-language program ends with semicolon(;);


Basic Structure of C Program Basic Structure of C Program Reviewed by JD Ahmad on June 18, 2018 Rating: 5

No comments:

Powered by Blogger.