Tutorial of C language
Computer Language
Introduction to C
Programming in C
Structure of C program
Variable in C
Datatypes in C
Token in C
Operator in C
Precedence of C Operator
Assignment Operator in C
Logical Operator in C
Bitwise Operator in C
Ternary Operator in C
C Input Output
Pointers in C
Storage Classes of C
Control Structure of C
C Decision Making Statement
C Looping Statement
C Jumping Statement
C Function
Function Call By Value
Function Call By Reference
C Input Output Function
C Structure
Array in C
Union in C

Structure of C programming language

The following is the structure of the C program.

Documentation Section

This section includes comment lines. For example: giving the name of the program and other details etc. Comments can be indicated in a 'C' program in between '/*' and '*/'.These comments are used in a program to increase its readability. Therefore, anything between /* and */ is ignored by the compiler, .i.e. it do not effect the speed of the program.
  • Example: /* Write a program to print the name of Programmer*/

    Link Section

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

    Definition Section

    This section defines all symbolic constants.

    Global declaration Section

    Global variables are the variables that are used in more than one function and are declared in this section i.e. outside of all the function.

    main() function

    Every 'C' program must have one main function. This execution of the program starts from here. This section consists of two parts.

    Declaration part:

    This part declares all the variables used in the executable part.
  • Example: int a=5;

    Executable part:

    This part contains the program statements to be executed. There must be at least one statement in this executable part. All statements in the declaration and executable part end with a semicolon. The program execution of a 'C' program begins at the opening braces { and ends at the closing braces } of the main() function. The closing braces of the main() function is the logical end of the program. All the statements between the two braces of the main function section is the logical end of the program. All the statement between the two braces form the function body, contains a set of instructions to perform the given task.

    Sub-program Section

    This section contains all the user defined functions that are called in the main function. This section is optional. This section is used when it is required. There can be any number of functions in this section.

    Steps in executing a 'C' program

    Execution of a 'C' program involves a series of steps. These are:
  • Creating the program.
  • Compiling the program.
  • Linking the program with functions that are needed from the 'C' library.
  • Executing a 'C' program.

    Important points in a 'C' program

  • Every 'C' program must have a main() function from where the program execution begins.
  • 'C' programs are written in lowercase letters. However, uppercase letters are used for symbolic names and output strings.
  • Every statement in a 'C' program must end with a semicolon.
  • All variables must be declared for their types before they are used in a program.
  • We must make sure to include header files using #include</code> directive to link the library functions used in a program.
  • When braces are used to group of statements, make sure that the opening brace has the corresponding closing brace.

    Character Set

    The characters in C are grouped in the following categories.
  • Letters: Uppercase (A to Z), Lowercase (a to z).
  • Digits: Decimal digits from 0 to 9.
  • Special characters: , : , ; , *, . etc.
  • White spaces: Blank space, Horizontal tab (\\t), New line (\\n) .
    Variable in C >>
    Datatypes in C >>
    Token in C >>
    Operator in C >>
    Precedence of C Operator >>

    Home Clouds