Tuesday, 30 October 2018

THE C PROGRAMMING LANGUAGE



Ok, Friends...Now, I am going to discuss the basics of the C programming language. Before start discussion about the C programming language, first, we will discuss the history of C like who developed it and why and what is the need of the C programming language.
       If you want to learn C++, C#, JAVA, JAVASCRIPT, Python and any other language it is necessary you have knowledge about C language. let's start...

HISTORY OF THE C PROGRAMMING LANGUAGE






  • Martin Richard developed BCPL (Basic Combined  Programming Language) in the year of 1967. He has developed a language for writing an operating system. Later, this language was invented by Ken Thompson and gave it a new name 'B'.  C uses many concepts of B language.

THE C PROGRAMMING LANGUAGE
Development of the C programming language



  • The C programming language was invented by Dennis Ritchie at AT & T Bell Laboratories in 1972.C uses many concepts of B language that's why it was named 'C'. C is a "High-Level Language" and it is easily understood by the user. Data types and structures are not introduced in the B language. 



The C Programming LAnguage
Dennis Ritchie creator of C, Unix

  • An operating system like Windows, Unix and Linux are written in C programming language.

Recommended Posts




STRUCTURE OF A C PROGRAM


From the structure, it means that any program can be written only in this structure. Therefore, writing a C program in any other composition will make the compilation error. The structure of the C program is as follows:



the C programming LAnguage
Structure of the C program

Write a Program to display "WELCOME TO THE HELLO WORLD!". 


There are many in-built library functions to do input/output tasks in C programming. The two most used functions for input/output are printf ( ) and scanf ( ). The scanf ( ) function reads the input data while printf ( ) sends the formatted output to the standard output (the screen).


 #include <stdio.h>
int main( )
{
printf ("WELCOME TO THE HELLO WORLD");
return 0;
 }


OUTPUT

WELCOME  TO THE HELLO WORLD




EXPLANATION



#include <stdio.h> : In the C program, all the lines starting with # are processed by the preprocessor, which is a program implemented by the compiler. In a very basic word, the preprocessor takes a C program. The program produced does not have any line starting from #,  all such lines are processed by the preprocessor. In the above example, the preprocessor copies the preprocessed code of stdio.h on our file. .h files are called header files in C. Declaration of functions are usually in these header files. We require stdio.h for the printf( ) function used in the program.


int main( ): This is a starting point from where the execution of C program begins. main ( ) can be written to take parameter also. The int wrote before main indicates return type of main( ). The value returned by main indicates the status of program termination. Main ( ) can be written as mention below:

1. main( ): blank parentheses indicates that the main( ) can have any argument.
2. void main( ): void means function does not return any value.
3. int main( ): int means function returns an integer value. so, it is necessary to mention return 0 at the end of the program.
4. main (void): It also indicates that there is no argument in the main function and return type is also void
5. int main (void): no argument with the integer return type.
6. void main (void): no argument with no return type.

printf ("WELCOME TO THE HELLO WORLD");: printf is a standard library which is used to print output at the screen. The semicolon at the end of this line indicates termination of line.

return 0;: The return statement returns the zero value to main( ). The value 0 means successful termination of the program.