what is the main difference between c and c++?
Answer Posted / priyanshu arya (delhi)
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 ? | 7 Yes | 1 No |
Post New Answer View All Answers
What is polymorphism and why is it important?
How do you define social class?
What is polymorphism explain?
What is meant by multiple inheritance?
Can we override main method?
What is abstraction in oops?
What is oops and its features?
is there any choice in opting subjects like 4 out of 7
How do you answer polymorphism?
Can we create object of interface?
What is encapsulation in simple terms?
What does and I oop mean?
What is overloading and its types?
What is object-oriented programming? Webopedia definition
How to use CMutex, CSemaphore in VC++ MFC