What is the difference between new() and malloc()?
Answers were Sorted based on User's Feedback
Answer / nashiinformaticssolutions
• new: Calls constructor, returns an object of the correct type.
• malloc(): Does not call constructor, returns void*.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nashiinformaticssolutions
o new initializes the object and calls its constructor.
o malloc allocates memory but does not call constructors.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / glibwaresoftsolutions
• new: Calls constructor, returns an object of the correct type.
• malloc(): Does not call constructor, returns void*.
Is This Answer Correct ? | 0 Yes | 0 No |
• new: Calls constructor, returns an object of the correct type.
• malloc(): Does not call constructor, returns void*.
Is This Answer Correct ? | 0 Yes | 0 No |
What is a parameterized type?
How do I get good at c++ programming?
Write an algorithm that determines whether or not an almost complete binary tree is a heap.
What are shallow and deep copies?
There is a array of 99 cells and we have to enter 1-100 elements in it , no two elements would repeat , so the is one no. missing because 99 cells and 1-100 nos. so we had to implement a function to find that missing no.
Is c++ free?
What is the use of the this pointer?
What is a constant? Explain with an example.
Is c++ pass by reference or value?
What is the difference between a copy constructor and an overloaded assignment operator?
4 Answers Belzabar, Citrix, Microsoft, Wipro,
What is the difference between a type-specific template friend class and a general template friend class?
What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00