Ask Experts » Computers » Software »
What is the difference between C and C++?
Date: 14 Apr 2011 Posted By: Raj kumar singh
Group: Computers Category: Software
What is the main difference between C and C++?
|Author: Akanksha P.V 18 Apr 2011 Member Level: Gold Points : 2 (Rs 1) Voting Score: 0|
C is a structure oriented language where the code is organised in the form of blocks of codes that are executed to achieve the resultant output. The blocks of code can be functions, structure etc. It follows procedure paradigm.
Whereas, C++ is an object oriented language where the coding is done by using the user defined objects. Objects in turn are instances of class. Classes are based on the concept of data abstraction where all the related data and functions are grouped together and during execution instances of these classes called objects are used to refer to the data inside its respective class.
This is the main difference between C and C++. Apart from this other common differences are:
1. C files are stored with an extension '.c' whereas C++ files are stored with '.cpp'.
2. C is a low level language and is less user friendly where as C++ is a middle level language and is easily interpretable by the machine and is more user friendly too.
3. The execution in C is from top to down where as that in C++ is from bottom to up.
4. We cannot do overloading with C where as C++ supports both function and operator overloading.
|Author: Kothari 18 Apr 2011 Member Level: Gold Points : 4 (Rs 2) Voting Score: 0|
->C is Procedure Oriented Programming Language (POP).
->C++ is Object Oriented Programming Language (OOP).
->C is mostly used to develop system software.
->C++ is mostly used to modal real life problem to program and use to develop application programs.
->C program has extension .C
->C++ program has extension .cpp
->C uses the top-down approach.
->while C++ uses the bottom-up approach.
->C is function-driven.
->while C++ is object-driven.
|Author: Dr.P.Ramachandran 19 Apr 2011 Member Level: Silver Points : 2 Voting Score: 0|
Both of them are computer languages. Object oriented C is called C++. Object oriented programming means a programming which have the concept of objects. Any thing that can be defined is called an object. In C++ we can describe any values. In C it is impossible. C++ is the developed form of C. C evolves from B and B evolved from BASIC. C is function oriented. All these peculiarities makes difference in both the programming languages.
|Author: Chirag Sachdeva 20 Apr 2011 Member Level: Gold Points : 2 Voting Score: 0|
C++ is object oriented language which is based on Objects and having private mode of data accessing whereas C allows structure formation using public mode. the new concept of inheritance, abstraction, data hiding etc are not there in c language.
I am providing a link of article through which you can know the Difference between c and c++ in full detail.
|Author: Jagannathan 25 Apr 2011 Member Level: Gold Points : 3 (Rs 1) Voting Score: 0|
C and C++ are the computer languages used for the programming concepts. The differences between C and C++ are noted below:
C is the procedural oriented language, where as C++ is an Object oriented language
The default header file used in C language is stdio.h and in C++ it is iosteam.h
C language does not support the OOPS concept, but C++ is based on the OOPS concept.
Programs written in C are stored with the extension .c and the programs written using C++ are stored with the extension .cpp
|Author: Ankit Agarwal 25 Apr 2011 Member Level: Silver Points : 4 Voting Score: 0|
C and C++ are high level languages.
-> Unlike C, C++ is an object oriented language, i.e., it has class structures.
-> C file has extensions .c whereas C++ files has extensions .cpp
-> C files use stdio.h whereas C++ use iostream.h as standard header files
-> The I/O commands for C are scanf & printf, and for C++ are cin and cout.
-> C supports GTK tool whereas C++ supports Qt tools for GUI programming.
|Author: Roshin K.P 26 Apr 2011 Member Level: Silver Points : 0 Voting Score: 0|
Hello Ankit, One point you made here is wrong. C is not an object oriented language. It is a Procedure-oriented language. You said that both C and C++ are OO languages. Other points are correct.
|Author: Ankit Agarwal 28 Apr 2011 Member Level: Silver Points : 0 Voting Score: 0|
Hello Roshin, I didn't mention that C is an OO language. Please look at the sentence carefully. I said Unlike C - not like C, C++ is an OO language.
|Author: Ankit Sharma 28 Apr 2011 Member Level: Gold Points : 6 (Rs 3) Voting Score: 0|
I want to make one change in my explanation. As pointed out by Mr. Roshin that C is a procedural language and not object oriented. Thanks for the correction.
C++ is high level programming language. It come under the category of OOP's i.e Object oriented programming languages. Where as C is a procedural language.
But since the question is about the differences between both the languages.
* C language was developed in AT & T bell laboratories. While C++ is the higher version of C with GUI(Graphics user interface) features developed by B. Stroutstrup.
* C++ has also some special features which were not present in C. For example: GUI programming tools.
* C++ provides the concept of Data hyding as it supports the classes where as C does not provide any such concept of data hyding as it does not support classes.
* C++ provides different data visibility modes : Public, Private, and Protected. Where as C does not have different visibility mode to store data. It stores data in a default mode irrespective of the data type.
* C does not support any features of Inheritance. Inheritance is one of the special characterstics of inheriting functions and other features of one class to another class. C++ provides this feature.
* It's operating commands are different from that of C++. For example: printf(), scanf() in C and cout, cin in C++ to perform the same function of output and input respectively.
There are many other differences in C and C++. And after pointing out so many differences, it is clear that C++ is very good programming language.
|Author: Roshin K.P 28 Apr 2011 Member Level: Silver Points : 2 Voting Score: 0|
Hello Ankit Agarwal, I didnt mention about your post. I tried to point out the mistake by Ankit Sharma. He early posted that--Both C and C++ are OO language. But he later changed it.Dont know where it gone--early it was above my post.Now it came below to me, I think he edited it. See, he came with the explanations.
Editors, I pointed out a mistake in an answer. And for that no points ? What an editing here ?
|Author: Vijay 08 May 2011 Member Level: Bronze Points : 2 Voting Score: 0|
C and C++ Both is programming language.
Difference between them are:-
1) C is a non object oriented or object base language but c++ is object base language.
2) WE use for Structure programming concept in c. and We use Class programming concept in C++.
3)We unable to reuse code of c language, whenever in c++ we can reuse the code of c++ language.
4)C is the father of C++.
5)To save file we use .c in c whenever in c++ we use .cpp.
6)C++ is more powerful language instance of c.
Active MembersTodayLast 7 Daysmore...