What is the structure of the C Program? with a demonstration

In structured programming, the user can divide a code into several smaller programs which are called functions.


C programming structure is based on the problem. But there are several structural elements and syntax that are constant in all problems. You can also view our articles on introduction to C programming here. Following are 3 types of programming used.

Structured Programming

In structured programming, the user can divide a code into several smaller programs which are called functions. This type of programming follows a “top-down” approach which means that the program execution starts from the first line of code and keeps on continuing till the last line. Ex: Pascal, C programming, etc.

Object-oriented Programming

In Object-oriented programming, as the name suggests, the user can use a new property called object which can be used to call a function multiple times. This ability gives the coder an option of reusability, which is an advantage of Object-oriented programming over Structured Programming. This programming follows the “Bottom-up” approach, which means that the program starts from a base element and follows the function and object calls. Ex: Java, C++, etc.

Non-Structured Programming

As the name indicates, this type of programming language does not follow any particular structure. They are executed sequentially and do not jump from any line. Ex: COBOL, BASIC, etc.

C programming follows Structured Programming.

Following is an example of a body of c program.

void main ( )
               data_type name;//(ex: int a, char b)              
scanf(“ “);//input function
printf(“ “);//output function


In C programming, the first lines contain the headers of a program. The header files contain already defined functions that can be used by calling them. Ex: stdio.h = is a header file that allows the scanner and printer function to scanf() and print(). math.h = provides functions like sqrt(), pow(), etc, which gives mathematical related function.

Main function

Another thing that is used with functions is return types, which depend on what type of value the function is returning.

Ex void = do not return a value

      int =  return integer value

      char = return character value

Variable declaration

A variable is declared as follows

datatype variable_name;

Ex = int Integer1;

Following are rules required for data name:

  1. The name should start with either alphabet (a-z or A-Z) or underscore ( _ ).
  2. Name can include alphabets, numbers, and underscore.
  3. Name cannot have commas or spaces.
  4. No special characters are allowed while naming variables.
  5. Names are case-sensitive i.e. name, Name, nAme, naMe, etc are different.
Default image
Kishore Mukherjee
Articles: 2

Leave a Reply