Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Hi chaitanya, it's because the new operator returns the pointer to the heap memory allocated and usually programmers assign this returned pointer to a local, static or global variable. You could also assign it to a pointer in the heap but still you would need a pointer in your local context in order to access it.
2nd Aug 2016, 10:35 PM
Stefan
Stefan - avatar