Line 11: | Line 11: | ||
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 . | 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. | main() function can be called from other functions . | main() function cannot be called from inside other functions. | ||
− | + | ||
− | |||
− | |||
Line 20: | Line 18: | ||
[[Category:Engineering|Difference Between C And C++]] | [[Category:Engineering|Difference Between C And C++]] | ||
+ | [[Category:Programming|Difference Between C And C++]] |
Latest revision as of 04:05, 1 May 2015
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. |