Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a=(int **)malloc(sizeof(int *)*3);
- if(a==NULL)
- {
- printf("Failed to allocate memory");
- return 1;
- }
- for(i=0;i<3;i++)
- {
- *(a+i)=(int *)malloc(10*sizeof(int));
- if(*(a+i)==NULL)
- {
- for(j=0;j<=i;j++)
- {
- free(*(a+j));
- free(a);
- printf("Failed to allocate memory ");
- return 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement