The document outlines the typical structure of a C program, including documentation, link, definition, global declaration, main function, and subprogram sections. The main function section contains declaration and executable parts and must include at least one statement. Additional user-defined functions are defined in the subprogram section if needed.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0 ratings0% found this document useful (0 votes)
122 views3 pages
02-Structure of C and Compilation Process of C
The document outlines the typical structure of a C program, including documentation, link, definition, global declaration, main function, and subprogram sections. The main function section contains declaration and executable parts and must include at least one statement. Additional user-defined functions are defined in the subprogram section if needed.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 3
STRUCTURE OF C PROGRAM
1. Documentation section: The documentation section consists of a set of
comment lines giving the name of the program, the author and other details, which the programmer would like to use later. 2. Link section: The link section provides instructions to the compiler to link functions from the system library such as using the #include directive. 3. Definition section: The definition section defines all symbolic constants such using the #define directive. 4. Global declaration section: There are some variables that are used in more than one function. Such variables are called global variables and are declared in the global declaration section that is outside of all the functions. This section also declares all the user-defined functions. 5. main () function section: Every C program must have one main function section. This section contains two parts; declaration part and executable part 1. Declaration part: The declaration part declares all the variables used in the executable part. 2. Executable part: There is at least one statement in the executable part. These two parts must appear between the opening and closing braces. The program executionbegins at the opening brace and ends at the closing brace. The closing brace of the main function is the logical end of the program. All statements in the declaration and executable part end with a semicolon. 6. Subprogram section: If the program is a multi-function program then the subprogram section contains all the user-defined functions that are called in the main () function. User-defined functions are generally placed immediately after the main () function, although they may appear in any order. COMPILATION PROCESS OF C PROGRAM FLOWCHART FOR COPILATION PROCESS