create array of pointers to files
问题 How would I go about making an array of file pointers in C? I would like to create an array of file pointers to the arguments of main... like a1.txt, a2.txt, etc... So I would run ./prog arg1.txt arg2.txt arg3.txt to have the program use these files. Then the argument for main is char **argv From argv, I would like to create the array of files/file pointers. This is what I have so far. FILE *inputFiles[argc - 1]; int i; for (i = 1; i < argc; i++) inputFiles[i] = fopen(argv[i], "r"); 回答1: The