cheking whether memory has allocated dynamically or not ?

karthik.v's Avatar
Newbie Member
hi...

please tell me how to check whether memory has allocated dynamically or not ?


any help is greatly appreciated.

thanks in advance :-)
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
If malloc returns NULL, then it didn't allocate anything.
0
zaster's Avatar, Join Date: Oct 2010
Light Poster
If you are using C++, new throws bad_alloc exception if memory is not allocated.