I read that delete[]
can deallocate an array of objects. However it is not mentioned in any of the sources I've read that whether it is an error or undefined to supply an argument like delete[3]
.
I have the following queries.
delete[]
as delete[3]
?delete
for an array allocated from new[]
?(1) Yes, it specifies you can't.
(3) It specifies the outcome is undefined, so don't.
delete[]
is an operator.
delete[x]
is not a valid c++ syntax, so the code wont compile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With