Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   cheking whether memory has allocated dynamically or not ? (http://www.go4expert.com/forums/cheking-memory-allocated-dynamically-t23607/)

karthik.v 18Oct2010 18:47

cheking whether memory has allocated dynamically or not ?
 
hi...

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


any help is greatly appreciated.

thanks in advance :-)

xpi0t0s 19Oct2010 12:44

Re: cheking whether memory has allocated dynamically or not ?
 
If malloc returns NULL, then it didn't allocate anything.

zaster 19Oct2010 20:12

Re: cheking whether memory has allocated dynamically or not ?
 
If you are using C++, new throws bad_alloc exception if memory is not allocated.


All times are GMT +5.5. The time now is 11:45.