How do you allocate and deallocate memory in C++?
Use the malloc() function to allocate memory in designated blocks and the new function to create a new function. To reallocate memory, the realloc() function is used. When finished, always include a free() function in order to free up the memory. If you used new(), use delete() to free up the memory.
| Is This Answer Correct ? | 0 Yes | 0 No |
Is atoi safe?
What are friend classes?
Is c++ map a hash table?
what is smart pointer & use of the smart pointer ???
Can a constructor throw a exception? How to handle the error when the constructor fails?
What are different types of polymorphism supported by C++
"How will you merge these two arrays? Write the program Array: A 1 18 22 43 Array: B 3 4 6 20 34 46 55 Output Array: C 1 3 4 6 18 20 22 34 43 46 55"
9 Answers College School Exams Tests, HCL,
What is an Object/Instance?
What do you mean by global variables?
How can you quickly find the number of elements stored in a dynamic array?
Can a function take variable length arguments, if yes, how?
What is ifstream c++?