The structure of a C program refers to the standard layout or organization of different sections that make up a C program. Every C program follows a logical sequence of sections that helps the compiler understand how the program should be executed.
Understanding the structure of a C program is essential for beginners because it explains where to write statements, how functions are organized, and how the program execution begins.

A typical C program consists of the following main components:
main() FunctionEach of these sections has a specific purpose and contributes to the correct execution of the program.
The documentation section contains comments that describe the program. It provides information such as the program name, author, date, and purpose.
This section is meant for human understanding and is ignored by the compiler.
// Program to add two numbers
// Author: IPLTS
// Date: 2025
#include)The link section tells the compiler to include header files required by the program. Header files contain predefined functions and macros.
#include <stdio.h>
For example, stdio.h provides functions like printf() and scanf().
#define)
The definition section is used to define symbolic constants using the #define directive.
These constants do not change during program execution.
#define PI 3.14
#define MAX 100
Using symbolic constants improves program readability and makes modifications easier.
The global declaration section contains global variables and function declarations that are accessible to all functions in the program.
int count;
float total;
Global variables are declared outside all functions and retain their values throughout program execution.
main() Function
The main() function is the entry point of a C program.
Program execution always starts from the main() function.
int main()
{
// statements
return 0;
}
It contains executable statements and may call other user-defined functions.
The return 0; statement indicates successful program termination.
User-defined functions are functions written by the programmer to perform specific tasks. They help in modular programming and reduce code repetition.
void display()
{
printf("Welcome to C Programming");
}
These functions are usually defined outside the main() function and called when needed.
// Program to print Hello World
#include <stdio.h> // Link section
#define MSG "Hello World" // Definition section
int main() // main function
{
printf("%s", MSG); // statement
return 0;
}
Explanation:
#include <stdio.h> allows use of printf().#define MSG defines a symbolic constant.main() starts execution.printf() prints output to the screen.main() is mandatory in every C program.