This is a little urgent...and I don't know what to make of t

Attached gaintest.c is a TGrapherror program that i hope to output 64 graphs in a 8x8 format. and gain1.txt is the input file. so gr[i] is where the graph is at and here is my error:
root [6] .x gaintest.c

*** Break *** segmentation violation
Generating stack trace…
0x00000001010db929 in G__getitem (in libCint.so) + 121
0x00000001010d747a in G__getexpr (in libCint.so) + 30506
0x00000001010e7000 in G__getfunction (in libCint.so) + 4432
0x0000000101124430 in G__new_operator (in libCint.so) + 4320
0x00000001010d91ea in G__getexpr (in libCint.so) + 38042
0x00000001010d854b in G__getexpr (in libCint.so) + 34811
0x00000001011571d5 in G__exec_statement (in libCint.so) + 21317
0x00000001010fc03b in G__interpret_func (in libCint.so) + 16939
0x00000001010e7610 in G__getfunction (in libCint.so) + 5984
0x00000001010dbaaf in G__getitem (in libCint.so) + 511
0x00000001010d747a in G__getexpr (in libCint.so) + 30506
0x00000001010cfcc8 in G__calc_internal (in libCint.so) + 984
0x0000000101165b95 in G__process_cmd (in libCint.so) + 17173
0x0000000100926461 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) (in libCore.so) + 817
0x00000001009267b9 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) (in libCore.so) + 121
0x0000000100884d7b in TApplication::ExecuteFile(char const*, int*, bool) (in libCore.so) + 2475
0x0000000100883f44 in TApplication::ProcessLine(char const*, bool, int*) (in libCore.so) + 1204
0x00000001017954c6 in TRint::HandleTermInput() (in libRint.so) + 678
0x000000010095e9b9 in TUnixSystem::CheckDescriptors() (in libCore.so) + 313
0x00000001009679eb in TMacOSXSystem::DispatchOneEvent(bool) (in libCore.so) + 379
0x00000001008e36aa in TSystem::InnerLoop() (in libCore.so) + 26
0x00000001008e35a7 in TSystem::Run() (in libCore.so) + 391
0x0000000100884ff4 in TApplication::Run(bool) (in libCore.so) + 36
0x0000000101794e0f in TRint::Run(bool) (in libRint.so) + 1439
0x0000000100879e1f in main (in root.exe) + 79
0x00007fff967e45fd in start (in libdyld.dylib) + 1
0x0000000000000003 in
Root > Function gaintest() busy flag cleared

I have never quite seen any errors like this before. What does it mean? is it because my program takes up too much memory?
This is a little urgent. Any help is appreciated!
gain1.txt (11.3 KB)
gaintest.c (13.1 KB)

.
gaintest.cxx (13.2 KB)
gain1.dat (11.3 KB)