Structure of a C Program
Dharani Tech Edu Hub Structure of a C Program Introduction Before writing complex programs, it is important to understand how a C program is structured. Just like a building needs a proper design, a C program also follows a specific structure. Understanding this structure helps you write clean, organized, and error-free code. Basic Structure of a C Program A C program is generally divided into the following sections: Documentation Section Link Section Definition Section Global Declaration Section Main Function Subprograms (User-defined Functions) Simple Example Program // Program to calculate area of circle #include <stdio.h> #define PI 3.14 int main () { int radius = 5 ; float area ; area = PI * radius * radius ; printf ( "Area of Circle = %f" , area ); return 0 ; } Output Area of Circle = 78.500000 Detailed Explanation of Each Section 1. Documentation Section Contains comments about the program H...