Difference between C, C++, java
C Language:
C language is a procedure oriented language. It has been invented by Dennis Ritchie in the year 1970. It is one of the computer programming language. The purpose of the language is used to describe the general and specific programming concepts. It is a platform independent language. Based on the concepts of C language the unix Operating System was came into market in the year 1972.
Operating System is the mediator between the user and the computer hard ware. It is completely written in C language programming to perform different facilities to the user and the first operating system is unix OS.
Operating System mainly consists of two kinds of interfaces. They are below:
- Command line interface
- Graphical line interface
Command line interface: Command line interface is also known as CLI and it is based on the commands that the user will interact with the computer.
Graphical user interface: Graphical user interface is also known as GUI and it is helpful in seeing graphical icons on the desktop the user will interact with the computer.
There are few more languages that are invented before the C programming language. They are below:
- Basic combined Programming Language (BCPL)
- B Language
Basic Combined Programming Language (BCPL): Basic combined programming language is invented by Martin Richards. This language will only describes about the basic command interactions. So this becomes the drawback of basic combined programming language and so started working on it to get better version of the language.
B Language: B Language is invented by Ken Thomsan. The main purpose of this language is to introduce the application specific programming concepts. So due to only specific applications there is no scope to apply the program for wide range of applications. Hence this has become the drawback of the B Language.
Therefore to overcome all the draw backs of the Basic Combined Programming Language and the B Language , Dennis Ritchie has proposed the C programming language in the year 1970. There is a particular structure to C programming.
Structure of C Programming:
To write a program in C language we need to follow a particular structure. Let us see the structure of C program.
Brief structure of C Program:
- Documentation Section
- Preprocessor Section
- Global Declaration Section
- Main Section
- User Defined Function Section
1.Documentation Section: Documentation Section is used to display the comments. The comments may be single line comments or multi line comments. We use ‘ // ‘ for single line comments at the starting of the comment and we use ‘ /* ----------- */ ‘ for multi line comments.
2.Preprocessor Section: Preprocessor section is also known as link section . Here we use the symbol ‘ # ‘ in the preprocessor section.
3.Global Declaration Section : Global declaration section is used to declare the variable globally throughout the program. We can also declare the functions in global declaration section.
4.Main Function Section : Main Section consists of main function with parameters and the return values. Main function section also consists of the further sections as shown below :
4.1 {
4.2 Local declaration of functions and variables
4.3 Executable statements
4.4 }
5.User Defined Function Section : User define function section is used to declare the user defined functions and then to define and call the functions. We can call the other functions using call by value and call by reference. User defined function function section also consists of the further sections as shown below :
5.1 {
5.2 Local declaration of functions and variables
5.3 Executable statements
5.4 }
There are different kinds of tokens and identifiers and key words in C language. There are nearly 32 keywords in C language.
The primitive data types that are used in C language are :
- Character data type ( char )
- Integer data type ( int )
- Float data type ( float )
- Double data type ( double )
Let us see a small program for C programming language with an example
Example 1:
//Write a program using C programming
#include<stdio.h>
#include<conio.h>
void main ( void )
{
clrscr( );
printf(“Welcome to C Programming”);
}
Output :
Welcome to C Programming