Advertisement
Guest User

Untitled

a guest
May 16th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement