we are going to learn about the basic structure of a C program (language). A C program is divided into different parts. There are four main parts to a basic c program.
Documentation section.
Header File section.
Constant and Global variables.
Main Function.
So now that introduction is out of the way, let’s jump to the main discussion. The whole “C” code follows this outline. Each code have a similar outline. Now let’s learn about each of this layer in detail.
DOCUMENTATION (Optional part)
HEADER FILE
CONSTANT AND GLOBAL VARIABLE
MAIN FUNCTION
Syntax of C Programming LanguageDOCUMENTATION SECTION.
The documentation section is the part of the program where the programmer gives the details of the program. He usually gives the name of the c program and the details of the author and other details like the time of coding and description. It gives the overview of the code.
HEADER FILE SECTION.
This section of the code is used to declare all the header files that will be used in the program. This is useful to the compiler being told to link the header files to the system libraries.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
CONSTANT AND GLOBAL VARIABLES.
In this section, we define different constants. And that value that we define that is used in whole c program.
MAIN FUNCTION SECTION.
Every C-program needs to have the main function. Each main function contains 2 sections. A declaration part and an Execution part. In the declaration part we declare all the variables. The execution part start with the curly brackets and ends with the curly close bracket. Both the declaration and execution section are inside the curly braces.
EXAMPLE
OUTPUT
0 Comments
If You have any query, Please let me know..