Thursday, November 26, 2009

Common mistake while allocating pointers and good programming practice

http://www.eskimo.com/~scs/cclass/int/sx7.html

Malloc may fail so it is always good to check the return value of malloc and then proceed..
One can also write a wrapper function to malloc which return space allocated to void pointer. We just need to type case this to desired data type..

SJ

No comments:

Post a Comment