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 new in c++?
If there are 1 to 100 Numbers in array of 101 elements. Which is the easy way to find repeated number?
What is pointer to array in c++?
Why is c++ awesome?
What are 2 ways of exporting a function from a dll?
How to declare a function pointer?
throw Can constructors exceptions?
What is size of a object of following class? class Foo { public: void foo(){} }
Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?
What is the use of endl in c++ give an example?
Why do we use the using declaration?
Explain bubble sorting.