When I allocate memory and do not call delete
, is this undefined behaviour?
Example:
int main(int argc, char** argv) {
int* a = new int[1];
// next code only to prevent optimization (hopefully)
*a = argc; std::cout << *a << std::endl;
// no delete
return 0;
}
(Let us assume the new
is not optimized out).