Introduction, Features & Structure of C- Programming Language

C Language was developed in the 1970s at Bell Labs by Dennis Ritchie.

The C language was derived from the B language, which was written by Ken Thompson at AT and T Bell lab. In 1982, a committee was formed by ANSI to standardize the C language. And In 1989, the standard for C was introduced known as ANSI C.

C was initially used for system development work. C was adopted as a system development language because it produces code that runs nearly as fast as code written in assembly language.

It was designed for programming in the operating system called UNIX. After the advent of C, the whole UNIX OS was rewritten in C.

Some examples of the use of C might be Operating Systems, Print Spoolers, Network Drivers, Utilities, Text Editors, etc.

Features of C Programming Language

  1. Highly portable.
  2. Structured programming language.
  3. General-purpose high-level language.
  4. It has only 32 keywords.
  5. Easily extended.
  6. Strong data type and powerful operators.
  7. Easy for debugging, testing, and maintaining.
  8. Fast for executing.
  9. Powerful built-in function to support various tasks.
  10. Can solve complex problems.

Structure of C program

C Program structure

A C-program has the following basic structure:

1. Documentation Section or comment section
2. Header section / Definition Section
3. Global Declaration Section
4. Main Function Section
5. Sub Program Section

1. Documentation/Comment Section:

In comment section, the user write a comment about program. And this is optional. There are two types of Comment sections supported in C:

  • Single line user comment:

In single line user comment are denoted by symbol //

e.g. //program to add two number

  • Multi line user comment

The multi line user comment are written with the symbol /*—-*/.

e.g. /*program to add two number*/

2. Header section / Define Section

This section is the compulsory section which is written after the comment section. And it started with the preprocessor statement (which start with #symbol).

e.g. #include, #define

The definition section defines all the symbolic constants.

3. Global declaration section:

The global declaration section is written after the include section. This section declares all of the global variables that are used.

e.g. float area(float r); int a=7;

4. Main Function Section:

The main function is required in all C programs. There are two sections of each function used in C: a declaration part and an execution part.

All of the variables are declared in the declaration section. The curly brackets are used to start the execution and to end it. The curly braces contain both the declaration and execution sections.

e.g.

int main(void)
{
int a=10;
printf(" %d", a);
return 0;
}

An example of C program

/* WAP to calculate the area of the circle*/
#include<stdio.h>	//header section
#define pi 3.14;	//defination section
float area(float r);	//global declaration 
int main()		//main function
{
float r;
printf(" Enter the radius:");
scanf("%f",&r);
printf("The area is: %f",area(r));
return 0;
}
float area(float r)
{
return pi * r * r;	//sub program
}
Print Friendly, PDF & Email

2 thoughts on “Introduction, Features & Structure of C- Programming Language”

Leave a Comment

Hey, wait!Get Regular Update's

Subscribe Stay Connected, Keep Learning!