Dynamic allocation

‘b’ is pointing to memory stored in heap so why showing that same memory in stack area also ?
We delete []b so heap memory will be deleted and in stack memory only a ‘b’ local variable will left no memory like as shown xyz in video and that too will be destroyed on return 0. !!!

hello @coderajay03

yeah only pointer will be there on the stack , allocated memory will be there on the heap

1 Like