[algogeeks] 2 Dim array as parameter

2012-06-06 Thread Ashish Goel
Hi, traditional C style of passing 2D array to a C func is for example, void func(char **pArr, int m, int n). Like we validate a pointer before accessing it if it is valid, how do we verify that the array provided indeed has got memory allocated to it before accessing it Best Regards Ashish

Re: [algogeeks] 2 Dim array as parameter

2012-06-06 Thread Abhishek Sharma
check the return value of malloc. on success,it returns the pointer to that memory on error, it returns NULL .. if( (char*)malloc(10)==NULL) { printf(Not Enough memory available); exit(1); } On Wed, Jun 6, 2012 at 7:20 PM, Ashish Goel ashg...@gmail.com wrote: Hi, traditional C