daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest May 16th, 2018 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  a=(int **)malloc(sizeof(int *)*3);
  2.         if(a==NULL)
  3.         {
  4.             printf("Failed to allocate memory");
  5.             return 1;
  6.         }
  7.         for(i=0;i<3;i++)
  8.         {
  9.             *(a+i)=(int *)malloc(10*sizeof(int));
  10.             if(*(a+i)==NULL)
  11.             {
  12.                 for(j=0;j<=i;j++)
  13.                 {
  14.                     free(*(a+j));
  15.                     free(a);
  16.                     printf("Failed to allocate memory ");
  17.                     return 1;
  18.                 }
  19.             }
  20.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top