Structure of C Program – Coding Part 2 (The comprehensive Guide)

Welcome to another supersession of learning of coding part 2 where you will learn the Structure of C program. So here we go!

Before starting this just go through the part 1 by following below given link:

Coding for Kids in C Language – Part 1

Structure of C Program

The structure of C program contains following components:

  1. The documentation section
  2. The link section
  3. The global declaration section
  4. The main function section
  5. The subprogram section

The documentation section

This section is used to provide the information about the program like program details, developer details and so on through comments. C supports two kinds of comments:

  1. Single Line comment
  2. Multi Line comment

Single line comment

The single line comment is starting // and then follows the text for comment. For ex.

// A program to understand the the structure of C program

The comments are not executable part of a program. Its just given for understanding the program.

Multi line comments

The multiline comment is starting with /* and ends with */. The explanatory text will be placed in between /*….*/. For example,

/* Program Developed By - Sanjay Parmar
   Website: www.tutorialaicsip.com
   Youtube: www.youtube.com/c/TutorialAICSIP
*/

The link section

The link section is used when you are going to use some of the library functions. A library function is a built in function of C library. The library function is included in the following manner:

#include<header_library>

For Example > #include<math.h> to use built in mathematics functions library.

Definition Section

This section includes the define section to declare or define a pre-processor directive. It starts with #. We will discuss this in a later stage.

Watch this video lesson:

Global Declaration

When you have multiple functions in C program, global variables plays an important role in program execution. This section of the program just declare the global variables and functions which can be accessed anywhere in the program.

Main Function

It is the area where you will write the main function. The main function is the top most part of a C program from where the execution of the program starts.

Subprograms

This section consists of different function definitions.

Click here for complete coding with C tutorials

Comment Your Views

%d bloggers like this: