Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 59 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. void *ma_sub(int s,int n,int *a)
  2. {
  3.     void *r;
  4.     if(n==1) {
  5.         return new char[s*(*a)];
  6.     }
  7.     r=new int[*a];
  8.     for(int i=0;i<n;++i) {
  9.         r[i]=ma_sub(s,n-1,a+1);    
  10.     }
  11.     return r;
  12. }
  13.  
  14. void *multi_alloc(int s,int n,...)
  15. {
  16.     void *r;
  17.     int *d;
  18.  
  19.     va_list arg;
  20.     va_start(arg,n);
  21.  
  22.     d=new int[n];
  23.     for(int i=0;i<n;++i) {
  24.         d[i]=va_arg(arg,int);
  25.     }
  26.     va_end(arg);
  27.    
  28.     r=ma_sub(s,n,d);
  29.  
  30.     delete d;
  31.    
  32.     return r;
  33. }
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