Introduction of C Programming Language

C is a powerful and high level structured oriented programming language. Mostly Programmers use this language for developing software like DataBase, Complier, and so on. The most important thing about C is that if you master in C then you can easily learn other programming languages also because C is the base for many programming languages.

Introduction Of C

C is a structured and robust programming language. It was developed by Dennis Ritchie in 1972 at Bell Labs. It was basically developed as the system programming language to write the code for Operating System and Database and so on. SQL is the most popular database which is also built by using the C programming language.

C is a structured programming language that allows writing the complex code or programs in the number of modules. The reason for writing the large code into the smaller - smaller modules is easy for testing and debugging the code. There is 32 keyword in C programming language that is int, char, float, long, and so on.

Structure of C program

Below is the structure of c programming language that tells us how to write the code in C.

void main()
// body contents....

Explanation of the above structure's component:-

1. Pre-Process Directory:- The very first one to write the code, is the inclusion of the #include component. It is the preprocess directory. The Preprocess directory always starts with a # sign followed by the directive name. It is basically used for including the user-defined and system-defined header files. If included files are not found in its own directory or in user-defined files, in that case, compiler throw error. Below I am going to list some most useful pre-process directory:-
#elif, and so on.

2. Header File:- The important thing about the header file is that it always contains .h in last of the file name. These are always written in "<"header files">". Some of the important header files are listed below:-
string.h and so on.
now I am going to give you a brief explanation about the above-mentioned header files
stdio.h meaning standard input and output header files. This file basically contains two file printf() and scanf(). scanf() is used for taking input and printf() is used for output.
conio.h meaning console input and output header files. This file contains two file clrscr() and getch().clrscr() is used for clear the screen and getch() is used for holding the output window.
math.h This define the number of mathematical functions which is used for mathematical calculation. Without including this file you can't access any predefined function of math.h. Some important math.h function and how they have written in the program, are listed below:-
pow - double pow(double a, double b) means return a raised to the power of b.
sqrt - double sqrt(double a) means to return the square root of a.
ceil - double ceil(double a) means to return the smallest integer which is greater than or equal to a.
floor- double floor(double a) means to return the largest integer which is less than or equal to a.
fmod - double fmod(double a, double b) means to return the remainder of a divided by b.
Except for this, there are more mathematical functions like sin, sinh, cos, cosh, tan, tanh, and so on.

3. void main():- Declaration of main function. A void is the empty return data type that never returns anything. You can also use int, float, double or any data type in place of the void as per requirement because these are the return data type. And the main is the function or you can say the main method from where the execution of the program begins.

4. {...}:- These are the opening and closing Curley braces that contain the body of code.

5. Body:- The body of the function is the main code where we write the code as per our requirement.

Below is the simple program to print "Hello world"

//Header files ....... please include stdio.h and conio.h after the #include
void main() //Main function
{ //opening curely braces
clrscr(); //clear screen
printf("Hello world"); //to print the output
getch(); //to hold the output window
} //closing curely braces

You can also use any return data type instead of non-return(void) data type Below is the program for return data type:-

//please include stdio.h and conio.h after the #include
int main(void)
printf("Hello world");
return 0;
See on the third line in the above code, the void wrote in the parentheses after the main method is simply indicates that this method is not taking any parameters. So whenever you used the return data type you have to mention the return keyword to return the result of the code if required.

Feedback and suggestions are most welcome.


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: