8/23/20

Basic Structure of C programs


Hey Friends, so far we have learned about some basic things of C programming language like ( Variable, Constant, Keywords, etc. ) Now today we are going to learn about the basic structure of c programming. So let’s begin..!!!

Basic Structures of C programs 

Basically, any c program is divided into 6 different sections. These Six Sections are:-



1. Documentation Section
2. Link Section 
3. Definition Section 
4. Global Declaration Section 
5. Main() Function Section 
6. Subprograms Section

Below you find a brief information on them.

Basic Structure of C programs

Documentation Section

In the Documentation Section, the Programmer gives the information (Details) about the program, author, coding details, and some other stuff that is used on it. Documentation Section helps anyone (user, programmer, author, owner, etc)  to get an overview of the program.

Example:- 


/**

* File Name: Helloworld.c


* Author: Suresh Mishra


* Date: 24/08/2020


* Description: a program to display hello world


*/



Link Section 

Link Section is a part of code that is used to add or insert-header files that will be used on the program. This section tells the compiler to link header files from the system libraries.

Example:- 

#Include <stdio.h>
#include<conio.h>

Definition Section 

In this section, we define the different constant. And also keywords as well.

Example:-  

#define PI=3.14

Global Declaration Section 

In this Section, Global variables are declared. All the Global Variable which is used on the program are declared in the global declaration section.

Example:-

int a=7 b= 10, float z = 7.10 etc

Main Function Section 

Every C program it is necessary to have the main function. Each Main Function contains 2 parts. 1. Declaration Part and 2. Execution Part. The declaration part is the part where all the variables are declared. And the execution part always starts with curly brackets and end with curly brackets. Both the part must have inside the curly brackets.

Example:- 
{
void main ()
{
Int a = 10;
printf(“%d”, a);  
return 0;
}

Subprograms Section 

All the user-defined functions are defined in this section of the program.

Example:- 


int add(int a, int b)
{
return a+b;
}

In this tutorial, we learn about the basic structure of C programming. If you find any mistakes on it. Or if you have any quarry related to it please comment below. Follow us for more programming tutorials.

You May Also Like 



"+y+""}else{if(A==5){c+='
  • '+w+""+y+"
  • "}else{if(A==6){c+='
  • "+w+'
    '+u+""+y+"
  • "}else{c+='
  • "+w+"
  • "}}}}}s.innerHTML=c+=""+y;d.callBack()};randomRelatedIndex=h;showRelatedPost=g;j(d.homePage.replace(/\/$/,"")+"/feeds/posts/summary"+e+"?alt=json-in-script&orderby=updated&max-results=0&callback=randomRelatedIndex")})(window,document,document.getElementsByTagName("head")[0]); //]]>

    0 comments:

    Post a Comment

    Follow on Twitter

    Linkedin

    Categories

    Contact Form

    Name

    Email *

    Message *

    Mad About Computer. Powered by Blogger.
    This site is in no way affiliated with or endorsed by specified business. It exists as a compendium of supporting information intended for informational purposes only. If you want to buy this website, please don't hesitate to contact us via e-mail: "d e n a c c 9 7 7 (at) g m a i l (dot) c o m" (delete spaces) or you can find and buy it on Afternic domain auctions.