Your prtnum holds the address of literal constant 5. That memory location has not been dynamically allocated from heap with new and therefore cannot be deallocated either.
To free memory and to practice the same thing for classes and structure and also to use this function to delete and store data for my phone book project
Thank you so much for help i appretiate it just one tiny thing could u implement this in simple code i tried it but i get syntax error or build errors i am bad at programming this will help me alot
like now value is deleted why does it show adress shouldnt show junk value
Some common misconceptions about delete:
1) delete ptr; does not actually delete the pointer. It deletes the data that the pointer points to. When you do newint; you are creating a new unnamed integer... and then your 'ptr' pointer points to that integer. When you delete ptr you are deleting the unnamed integer, but are not changing 'ptr' at all.
2) Deleting a basic type like an int simply de-allcates memory. It does not [necessarily] fill that memory with garbage values. So it's very possible that the data will still be in that memory even after the data is deleted. Though it isn't guaranteed, as that memory may get allocated somewhere else and/or be overwritten by something else.