• Basic Structure of C Language Program

    Basic Structure Of C Language Program

    In Basic Structure of C Language Program can be divided into several sections. A C program can be viewed as a group of building blocks called functions.  A function is a subroutine that may include one or more statement designed to perform a specific task.  To write a C program, we first create function and then put them together.  A C program may contain one or more section describe below.

    Basic Structure of C Language Program

    Basic Structure of C Language Program

    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.

    Link Section :

    The link section provides instructions to the compiler to link functions from the system library.

    Definition Section :

    The Definition Section defines all symbolic constants.

    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.

    main() Function Section :

    Every C program must have one main() function section.  This section contains two parts, declaration part and executable part.  The declaration part declares all the variables used in the executable part.  There is at least one statement in the executable part.  These two parts must appear between the opening and the closing brace.  The program execution begins at the opening brace and ends at the closing brace.  The closing brace of the main function section is the logical end of the program.  All statements in the declaration and executable parts end with a semicolon.

    Subprogram Section :

    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.

    Appreciate my work :Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on RedditShare on StumbleUponShare on TumblrDigg thisShare on YummlyShare on VKFlattr the authorBuffer this page

Leave a Reply

Your email address will not be published. Required fields are marked *