Skip to main content

Structure of a C Program

A C Program has the following sections;

Documentation: This is where the name of the writer is placed as well as a description of the program.
Preprocessor/Link: This is where C libraries are called so that certain functions are able to work in the program.
Global declaration: The functions and global variables, those variables which should be available to all statements in the program are placed under this section.
Definitions: Constants are defined in this section. The declaration is not a statement and therefore should not be terminated by a semicolon. Capital letters are used to represent a constant.
Main Function: Program execution begins in the main function.
Sub Programs: These are user-defined functions
Local Variables: These are variables declared in a function and only that function can access the variable.

Below is sample code demonstrating recursion as well as showing the full structure of a C Program.

Comments

Popular posts from this blog