+ 8
How to find out how much memory the new operator allocated? Must be 200 bytes
11 odpowiedzi
+ 11
Find it out by using the sizeof operator and run. Different device gives different result so yeah, I can only find out using the sizeof
+ 8
You don't. You have to keep track of this yourself.
It is implementation defined where the compiler stores that information for the delete call.
Unless the new call throws a bad_alloc exception and/or returns a nullptr you can be sure that it allocated at least the space you requested.
+ 5
I'm not sure what the question was...
+ 5
UraL I understand now.
+ 5
UraL I think the only way is using 50*sizeof(*a) so the programmer has to keep track of the size of memory dynamically allocated in C.
+ 3
👑Miss Solollearn Philippines (Storm Me) sizeof is not applicable in this case. give an example
+ 1
Dennis ok
+ 1
Sonic why? The question is concrete
+ 1
use "sizeof()" function
+ 1
Sumiya do it and show result:-)
+ 1
Sumiya read above