what is the main difference between c and c++?
Answer Posted / adil siddiqui
1.C is a structured programming language while C++ is an
object programming language .
2.c++ support operator overloading but c doesn't support
operator overloading
3. C employs top down approach, but c++ employes buttom up
approach.
4.C give emphasis in algorithims and functions, but C++
give emphasis on the data and objects.
5.In C we are using #include<stdio.h> as header file, but
in C++ we are using #include<iostream.h> as header file.
6.In C memory allocation is done with malloc statement
whereas in C++ it is done through new keyword.Also memory
is deallocated in C using free statement while in C++
deallocation takes place through delete.
7. *Inline functions are not available in C.
8.The I/O functions are entirely different in C and C++
(ex: printf( ), scanf( ) etc. are part of the C language).
9.Structures in C cannot have functions
10.You cannot overload a function in C (i.e. you cannot
have 2 functions with the same name in C).
11.C does not have reference variables (in C++
referencevariables are used in functions).
12.In other worlds C is used more with hardware while C++
is used more with software, mainly because of more
abstraction and features in C++.
13.You have to include the struct keyword before the name
of the struct type to declare a struct: In C++, you could
do this, and have a new instance of a_struct called
struct_instance. In C, however, we have to include the
struct keyword when declaring struct_instance
14.C++ has a much larger library than C, and some things
may be automatically linked in by C++ when they are not
with C.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is abstraction and encapsulation?
What is polymorphism explain its types?
Why is abstraction needed?
Where is pseudocode used?
program for insertion ,deletion,sorting in double link list
Are polymorphisms mutations?
What causes polymorphism?
What are the 5 oop principles?
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
What is polymorphism in oops with example?
What is abstraction in oops with example?
What is abstraction in oops?
What is object-oriented programming? Webopedia definition
Write a program to sort the number with different sorts in one program ??
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.