the difference between new and malloc

Answer Posted / prakruthi

new automatically calls the constructor while malloc()
dosen't., also new being an operator, it can be overloaded.

since malloc returns a void pointer it is necessary to
explicitly typecast it into an appropriate type of pointer.
This gets completely avoided when we are using new operator.

Is This Answer Correct ?    25 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is oops in simple words?

579


What is the difference between inheritance and polymorphism?

590


Why multiple inheritance is not possible?

598


What is abstraction in oop?

631


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

2034






What does no cap mean?

590


Why do while loop is used?

575


Why is encapsulation used?

577


how to get the oracle certification? send me the answer

1670


Why we use classes in oop?

581


Why do we need oop?

671


What does and I oop mean in text?

623


Is this job good for future? can do this job post grduate student?

1692


What is for loop and its syntax?

596


State what is encapsulation and friend function?

699