Difference Between C And C++
C and C++ both are general-purpose programming languages , the latter being developed from the former , thus having many differences between them . Here are the major differences between the two :
C | C++ |
---|---|
C is a procedural language . | C++ is an object-oriented language. |
C does not support polymorphism , operator overloading and inheritance . | All these features are supported in C++. |
In C scanf() and printf() functions are used for reading input and showing output respectively . | In C++ Cin>> and Cout<< are used for reading input and showing output respectively. |
In C, we can call main() Function through other Functions | In C++, we cannot call main() Function through other functions. |
Exception handling is not possible in C . | Exception handling is possible using try-catch blocks. |
In C, malloc() , calloc() and free() functions are used for Memory allocation and freeing respectively . | In C++, new and delete operators are used for memory allocation and freeing . |
main() function can be called from other functions . | main() function cannot be called from inside other functions. |