FYI on posting Code snippets:
Here are some comments:
TString fname;
TFile *input[n];
for (Int_t i=0; i<n; i++){
//The following block is old code that should be removed,
// left to indicate what the issues were.
//This line will not incorporate the index i
//fname = “.filename[i]”;
//This line will try to open a file called "fname".
// The pointer input will be overwritten on every loop and input will only
// point to the last file open, while all the others will still be open.
//input = TFile::Open(“fname”);
//This will create a filename that is appended with index i.
fname = Form("filename_%d", i);
std::cout << "Opening filename: '" << fname << "'\n";
//This will open a file with the name stored in the variable fname.
//This will store each pointer to the files separately.
input[n] = TFile.Open(fname);
}