Dear Rooters:
This is my first program to be written in Root . I am analyzing a 1D-histogram and trying to put into an array the data values that make up the histogram by using the function ‘GetBinContent’. Everything works fine if I assign a variable to each output from ‘GetBinContent’. But once I assign an array to the outputs of this function, I obtain an error:
Error: Array index out of range d[i-1] -> [0] valid upto d FILE:MinosHist.C LINE:53
Now, I have checked several times the dimensions of my arrays and they are correct. What may you suggest is the best way to put into an array the ouputs from
Thank you very much.

Float_t c;
Float_t d[bin_number];
Int_t i;
for (i = 1; i<limit; i++){
c = hist->GetBinContent(i);
printf(“c = %f\n”, c);
d[i-1] = c;
printf(“d[i-1] = %f\n”, d[i-1]);
//bin_number = 18;
//limit = 19;


You code snippet is too short for a definite answer.

However, you might not have consider the fact that a 1D histogram contains 2 more bins that requested (for overflow and underflow).

Hence you array d needs to be: