×

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:

  1. Documentation Section
  2. Preprocessor Section
  3. Global Declaration Section
  4. Main Section
  5. 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

Related Topics

Hamming Code in Java

In a computer network, hamming code is a unique set of error-correction codes. It is mostly utilised in computer graphics for mistake detection and correction during data transmission from sender...

8 minutes read.

Java Buffered Writer

BufferWriter Class: It is used to write the data more efficiently. This class is present in the java.io package, it inherits the data from the Writer class. Writer class is...

4 minutes read.

Java String toCharArray() method

Java String toCharArray() method converts current String into character array. Syntax: public char[] toCharArray() Returns: It returns a character array Java String toCharArray() method example 1 import java.util.Arrays; public class JavaStringToCharArrayEx1 {           public static...

2 minutes read.

Spliterator in Java 8

In this tutorial, we will understand the meaning of spliterator in java 8. It is just like any other iterator available in java used to traverse the elements of either...

4 minutes read.

Java Database Connectivity with Oracle

JDBC: A Programmer can develop a complete application using the Java built-in API’s. So, for storing the data required for solving a real-world problem is stored into a database. To connect...

5 minutes read.

Java Double Keyword

In java primitive data types, we have two different types of data types which are Boolean and floating-point data types.In floating data type again we have four types which are...

3 minutes read.

Repdigit Numbers in Java

A combination of repeated and digit, the term is. A repdigit, also known as a monodigit or a positional number system, is a natural number in recreational mathematics made up...

3 minutes read.

How to convert double to String in Java

How to Convert double to String in Java It is used when we want to convert double primitive to String type. There are two methods to convert double to String. Using String.valueOf()...

2 minutes read.

Thread Program in Java

Thread Program in Java Thread program in Java is the continuation of multithreading program in Java. In this topic, we will learn about the usage of threads, race condition in multithreading,...

8 minutes read.

Java Boolean Keyword

Boolean keyword In java programming language we basically have two types of primitive data types, Boolean and Numeric (integer and floating-point data types). In this article we are going to learn...

4 minutes read.

Prepared statement in Java

Prepared statement: A prepared statement is a statement that is pre-compiled SQL statement, and it is a sub-interface of a statement. Compared to other statement objects in java, Prepared Statement objects have...

3 minutes read.

PriorityBlockingQueue Class in Java

What is the Queue? An abstract data structure like Stacks is a queue. A queue is open on both ends. Data is always pushed to one end, called enqueue, and removed...

4 minutes read.

Java String getChars() Method

Java String getChars() method copies characters from current String to the destination character array . Syntax: public void getChars(int srcBeginIndex, int srcEndIndex, char[] destination, int dstBeginIndex) Parameters: srcBegin - index of the first character...

1 minute read.

Methods in Java

The Methods in Java are the collection of statements that are executed when the method is called. By using the methods, the complexity of writing the code decreases. The method consists...

4 minutes read.

Java Variable

The variable is the basic unit of storage in a program. We define a variable using an identifier, a type, and an optional initializer in Java. In Java, variables must be...

4 minutes read.

Centered Square Numbers in Java

In this tutorial, we will understand how to check the number is a centered square number. It is one of the prevalent interview questions of IT companies. Firstly, we will...

3 minutes read.

Producer Consumer Problem in Java Using Synchronized Block

The producer-consumer dilemma is a well-known instance of a multi-process synchronization issue in computing. Two processes—the producer and the consumer—are described in the issue, and they share a single, fixed-size...

4 minutes read.

How to find characters with the maximum number of times in a string java

Problem statement In this problem, users want to find the maximum count of a character from the string and return the character along with its count. Your task is to create...

3 minutes read.

Java Array Generic

Creating Generic Array in Java A collection of comparable sorts of data is kept in an array. In Java, making a generic array is challenging. The type information of an array's...

4 minutes read.

Rotate matrix by 90 degrees in Java | Rotate matrix in Java clockwise and anti-clockwise

In this article, you will be acknowledged about what is a matrix along with an example. Most importantly you will be equipped knowledge on how to rotate the matrix by...

4 minutes read.