Which of the following statements is true about the new and malloc?
Which of the following statements is true about the new and malloc?
I. The 'new' is a type of operator while 'malloc' is a kind of function.
II. The 'new' invokes a constructor, whereas 'malloc' does not invoke the constructor.
III. The 'malloc' returns void pointer and also needed to typecast whereas 'new' returns required pointer.
Show answerHide answer
Correct answer: (D) More than one of the above
Explanation
All three statements are true (new is an operator that calls constructors; malloc is a function returning void*), so more than one option, i.e. (D), is correct.