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.
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.
|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.
- An operating system like Windows, Unix and Linux are written in C programming language.
- THE C PROGRAMMING LANGUAGE
- LEARN DATA TYPES IN C WITH VIDEO
- IF STATEMENT IN C
- IF-ELSE STATEMENT IN C
- WHAT ARE THE LOOPS IN C
STRUCTURE OF A C PROGRAM
|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).
int main( )
printf ("WELCOME TO THE HELLO WORLD");
WELCOME TO THE HELLO WORLD
#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.