What is the difference between creating an object,
using 'new' and using 'malloc'?

Answer Posted / btech

new operator returns a pointer of the correct type and
malloc() returns a void*

New calls the object’s constructor and malloc does not.

Any object created with new must be freed using delete and
where as malloc() and free() allocates and deallocates
memory

new operator can be overloaded by a class, where as
malloc() can't be overloaded.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is C++ exceptional handling?

633


What does namespace mean in c++?

557


Why was c++ made?

654


write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)

1806


What is a c++ object?

617






What is a volatile variable in c++?

563


What is friend class in c++ with example?

504


Search for: what is pair in c++?

595


Which is most difficult programming language?

582


Which format specifier is used for printing a pointer value?

582


What are the differences between the function prototype and the function defi-nition?

625


What is the array and initializing arrays in c++?

510


What is runtime polymorphism in c++?

595


What do you mean by volatile and mutable keywords used in c++?

584


What is c++ mutable?

706