4 questions
In C++, there are many ways to dynamically allocate, right?Then when should I use malloc and when should I use new?malloc If you finished freeIf new is done, deleteI know I shouldn't mix the two.
On my computer,cout << new int[0] << endl;When I ran , I printed 0x876c0b8.I think I'm allocating memoryAssigning [0] means assigning empty. Personally, I thought there would be an error, ...
When you create an instance of the Test class that I define.What's the difference between the two?Is there a difference?
Can I write delete this; when I delete an instance of the class I created with new at the end?Write it like this. void doStuff(){ // This object is a working module // When you want to switch to anoth...
© 2024 OneMinuteCode. All rights reserved.