Re: dynamically allocating memory for two dimensional array

From: James Dinan (dinan_at_cse.ohio-state.edu)
Date: Fri Jul 17 2009 - 07:50:42 PDT

  • Next message: Benjamin Byington: "Re: dynamically allocating memory for two dimensional array"
    sainath l wrote:
    > Hi again,
    > 
    > I still haven't worked out how to do this, and it is very important for me.
    > 
    > I am trying to find out the overhead associated with  allocation routines.
    > For this I need to run the allocation routines N times. I do not know at
    > compilation the value of N.
    > 
    > I therefore need to allocate memory to the pointer
    > 
    > shared int  *shared *shared a;
    > 
    > to obtain an array of shared pointers each of which points to shared
    > integers.
    > 
    > Once again, I would be very grateful if someone could suggest how I
    > might achieve this.
    
    Hi Sainath,
    
    "*shared" is specifying storage for a so I think you only need to give
    the shared once.  I would suggest something like:
    
    typedef shared int * shr_int_p;
    shr_int_p *shared a;
    
    Good luck,
     ~Jim.
    

  • Next message: Benjamin Byington: "Re: dynamically allocating memory for two dimensional array"