[ROOT] multidimensional dynamic arrays

From: Raymond Fliller III (rfliller@bnl.gov)
Date: Thu Sep 07 2000 - 01:38:45 MEST


 - Rooters

   I'm quite new to ROOT, so much so that my unbilical cord is still attached.

I'm trying to make a 2 dimensional dynamically allocated array to read in an

ASCII file.  The way I have done it in other programs is:

  double **array;

  ..... later on

    array= new double *[xsize]

    for (i=0;i<xsize;i++){

        *(array+i)=new double [ysize]

    }

  Then when I go to set array[i][j], I get a segmentation fault, for

any i,j value.

    I'm assuming that this is the correct way as it has worked for me in C++

in the past, unless I'm doing something incredibly wrong and have just

gotten lucky in the past.  Thank's a lot.

==============================================================================
Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124
C-A Accelerator Physics
Building 911
Brookhaven National Lab
Upton, NY 11973                    Office: Room 211
==============================================================================



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:32 MET