What are the differences between new and malloc?
Answer / Mohammad Azeem Khan
new is an operator in C++ that dynamically allocates memory for objects, creates them, and initializes them. It automatically calls the constructor of the class being instantiated. On the other hand, malloc() is a library function in C that only allocates raw memory without constructing or initializing any object. To use malloc(), you must manually call the constructor.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is an action class?
Explain overriding.
Do you know what are static and dynamic type checking?
Are strings immutable in c++?
whats the size of class EXP on 32 bit processor? class EXP { char c1; char c2; int i1; int i2; char *ptr; static int mem; };
write the prime no program in c++?
When is the last time you coded in C/C++? What is the most lines of original C/C++ code you have personally written in one project? How confident are you in your ability to write C or C++ without a reference?
Define the process of error-handling in case of constructor failure?
Can I run c program in turbo c++?
What is setfill c++?
What is meant by a delegate?
What is a manipulative person?