Can a new be used in place of old mallocq? If yes, why?
Answer / Sanchit Srivastava
Yes, the 'new' operator can replace 'malloc', but it provides additional functionality such as automatic memory deallocation (using 'delete') and constructors for object initialization. However, it is not exactly equivalent to malloc, as new does not support memory alignment control or returning NULL on failure.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the operator in c++?
What is the stack?
What is abstraction in c++ with example?
What is virtual destructors? Why they are used?
What is the difference between a class and a structure in C++?
What is static function? Explain with an example
Explain the scope resolution operator?
Can c++ be faster than c?
Is c++ the best programming language?
What does it mean to declare a destructor as static?
What does h mean in maths?
Why are arrays usually processed with for loop?