C Language Introduction, Structure of C Programming | Full C Language Program 2021

 C-Language






C is a procedural programming language. It was initially developed by Dennis Ritchie in the year 1972. It was mainly developed as a system programming language to write an operating system.


The main features of the C language include low-level access to memory, a simple set of keywords, and clean style, these features make C language suitable for system programming’s like an operating system or compiler development.


Like syntax of Java, PHP, JavaScript, and many other languages are mainly based on the C language.


Beginning with C programming:


  •  Structure of a C program:

  
Structure, it is meant that any program can be written in this structure only. Writing a C program in any other structure will hence lead to a Compilation Error.


Documentation Section: 

The documentation section is the part of the program where the programmer gives the details associated with the program. He usually gives the name of the program, the details of the author, and other details like the time of coding and description. It gives anyone reading the code an overview of the code.

Example

 

/**

 

* description: a program to display hello world

 

*/




Link Section


This part of the code is used to declare all the header files that will be used in the program. This leads to the compiler being told to link the header files to the system libraries.


Example

 

#include<stdio.h>



 Definition Section

In this section, we define different constants. The keyword define is used in this part.

 

Example


#define PI=3.14




Global Declaration Section

This part of the code is the part where the global variables are declared. All the global variables used are declared in this part. The user-defined functions are also declared in this part of the code.

 

Example


float area(float r);

int a=7; 


 

Main Function Section


Every C-program needs to have the main function. Each main function contains 2 parts.


A declaration part and an Execution part.


The declaration part is the part where all the variables are declared. The execution part begins with the curly brackets and ends with the curly close bracket. 


Both the declaration and execution parts are inside the curly braces.


Example


int main(void)

{

int a=10;

printf(" %d", a);

return 0;

}



Sub Program Section


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

Example


int add(int a, int b)

{

return a+b;

}




Continue C language in an Order Click Continue & Join WhatsApp Group For Learn Programming Questions, Online Teaching
















Post a Comment

Previous Post Next Post