Q:

What is the difference between C and C++?

0

What is the difference between C and C++?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

The below comparison chart explain some important difference between C and C++.

C C++
C is a structural or procedural programming language. C++ is an object-oriented programming language.
 C doesn’t have variable references. C++ has variable references.
C doesn’t support function or operator overloading C++ supports function as well as function overloading.
C does not support information hiding. Data is hidden by Encapsulation to ensure that data structures and operators are used as intended.
“namespace” features are not present in C. “namespace” is used by C++, which avoids name collisions.
Virtual and friend functions are not supported by C. Virtual and friend functions are supported by C++.
In C, functions can not be defined inside structures. In C++, we can define functions inside structures.
C doesn’t provide direct support for error handling C++ supports exception handling that helps in error detection and smooth handling.
C uses malloc(), calloc() for memory allocation and  free() for memory de-allocation . In C++, generally, “new operator” is used for memory allocation, and deletes operator is used for memory deallocation.
C does not support inheritance. C++ supports inheritance.
C does not support generic programming. C++ supports generic programming with the help of templates.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions and Answers(2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is a class in C++?... >>
<< Define C++?...