Structure of C Programs

Every programming language has its own structure in which the program code should be written. In this lesson, we are discussing the structure of C programs.

Let’s consider the simple C program given below:

  /*Example Program*/
  printf("Welcome to CSAdeeb.com");

The output of the above program should be as shown below:

Welcome to TECHAntena

The first line of the program code contains a function main().

The main() is required by every C program. The execution of a C program starts from the main function.

The second line has an opening brace { which is used to indicate the beginning of the function main().

The third line of the program code contains /* and */ which is used to provide additional information on the program code to the programmer. Anything between /* and */ will not be executed by the compiler and is called Comments.

The fourth line contains the instruction to print “Welcome to CSAdeeb.com”. The printf() is a function used to print things in the C programming. This line of code is to be called a statement.

The last line of the code contains an ending brace { which indicate the ending of the function body.

Structure of C Programs

Structure of C Programs