Guest User

Untitled

a guest
Nov 1st, 2017
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void *xmalloc(size_t  nrOcteti)       *a=a[0],**a=a[0][0]
  2. {
  3.     Void *p;            a[1]=*(a+1)
  4.     P=malloc(nrOcteti);     &a[i]=(a+i)
  5.     If(p==0)
  6.     {
  7.         Fprintf(stderr,”Memorie insuficienta”;
  8.         Exit(EXIT_FAILURE);
  9.     }
  10. Return p;
  11. }
  12.  
  13. Free(a); //eliberare memorie
  14. A=0;
  15.  
  16. Int **alocare2d(size_ nt,size_t m);  //la alocaer 2d se face si xmalloc
  17. {
  18.     Int **a;   int i;
  19.     A=(int**)xmalloc(n*sizeoff(int*));
  20.     For(i=0;i<n;i++)
  21.         {
  22.         A[i]= =(int**)xmalloc(m*sizeoff(int*));
  23.         }
  24.     Return a;
  25. }
  26.  
  27. void dealoca2d(int **a,int n)
  28. {
  29.     Int i;
  30.     For(i=0;i<n;i++)
  31.     {
  32.     Free(a[i]);
  33.     A[i]=0;
  34. }
  35. Free(A);
  36. }
Add Comment
Please, Sign In to add comment