the C programming language

Ok, Friends...Now, I am going to discuss the basics of the C programming language. Before start discussion about C programming, first, we will discuss the history of C like who developed it and why and what is the need of the C language. C is a general-purpose, procedural computer programming language.

If you want to learn C++, C#, JAVA, JAVASCRIPT, Python, and any other programming language, you must know the basics of the C language. Let’s start...

Features of the C programming language

1. C is a case-sensitive programming language, and it follows the scope rule.
2. This language is easy to learn and understand.
3. There is a lot of arithmetic and logical operator in the C language, such as +,++,-, =, &, ! etc.
4. It has a fixed number of keywords.
5. Programmer can create its data type in the C programming language using the keyword struct, union, enum, etc.
6. Supports preprocessor that executes before the compilation.
7. It also supports pointers.
8. You can avoid function return values if you don't want to use it.

Why use C language?

There are various reasons to select the C programming language for development language. I have some reason that describes why C is a popular language and why most of the people use it.
1. C is a general-purpose language and easy to learn, whatever you learn in the C language, you can be used in the future programming language.
2. This language is the right choice for the designing of an operating system such as Microsoft's windows, Mobile phone's operating system.
3. C is used in the creation of language compiler and interpreter.
4. A lot of legacy programs are written in the C language.
5. This language is also a portable language.
6. C language is also used in the database (Oracle database, MySQL).
7. This language is also used in the designing of embedded systems.
8. It is widely used in IoT (Internet of Things) applications.

History of the C programming language

The first programming language, 'ALGOL,' is introduced in the year 1960. This language is widely used in European Countries. A new programming language i.e., Basic Combined Programming Language (BCPL) is developed in 1967 which is specially designed for writing system software. Martin Richards developed this language.

the C programming language
Dennis Ritchie

After three years, in 1970, a new programming language 'B' is designed by Ken Thompson at AT&T and Bell Laboratories. In 1972, Dennis Ritchie developed a new programming language called 'C' at Bell laboratories. This language consist features of 'ALGOL,' 'BCPL' and 'B' programming language.
UNIX operating system is written in 'C' language. At the initial stage, 'C' is used only for designing the operating system, but as it becomes popular, this language is used commercially, and many compilers are designed for cross-platform systems. Nowadays, various operating system and hardware platform are created using the C programming language. As it started evolving, many different versions of the language were released.

the C programming language

In 1989, the American National Standard Institute (ANSI) declared a commercial standard for 'C' programming language. In 1990, 'C' language is approved by the International Standard Organization (ISO). This language is also known as 'ANSI C.'

Structure of 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 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 the C programming language. 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( )
return 0;

Explanation of C Program

#include: A program in the C programming language, preprocessor process all the lines starting with #. In a fundamental word, the preprocessor takes a C program. The program produced does not have any line starting from #, the preprocessor processes all such lines. In the above example, the preprocessor copies the preprocessed code of stdio.h on our file. .h files are known as 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. The int wrote before main indicates return type of main(). The value returned by main indicates the status of program termination. You can write main()  function as mention below:
1. main(): blank parentheses indicates that the main( ) can have an 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 function. It prints output at the screen. The semicolon at the end of this line indicates the termination of the line.

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

No comments:

Powered by Blogger.