Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void *xmalloc(size_t nrOcteti) *a=a[0],**a=a[0][0]
- {
- Void *p; a[1]=*(a+1)
- P=malloc(nrOcteti); &a[i]=(a+i)
- If(p==0)
- {
- Fprintf(stderr,”Memorie insuficienta”;
- Exit(EXIT_FAILURE);
- }
- Return p;
- }
- Free(a); //eliberare memorie
- A=0;
- Int **alocare2d(size_ nt,size_t m); //la alocaer 2d se face si xmalloc
- {
- Int **a; int i;
- A=(int**)xmalloc(n*sizeoff(int*));
- For(i=0;i<n;i++)
- {
- A[i]= =(int**)xmalloc(m*sizeoff(int*));
- }
- Return a;
- }
- void dealoca2d(int **a,int n)
- {
- Int i;
- For(i=0;i<n;i++)
- {
- Free(a[i]);
- A[i]=0;
- }
- Free(A);
- }
Add Comment
Please, Sign In to add comment