I have a .txt file that I am using to learn some basic C.
Here is the txt file:
8
12 48 15 65 16 82 9 72
Here is my C program:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv){
char num = 0;
//int[] arr = 0;
if (argc != 2){
return 0;
}
FILE *inputFile = fopen(argv[1], "r");
if (inputFile == NULL){
printf("Error1\n");
return 0;
}
while(!feof(inputFile)){
num = fgetc(inputFile);
printf("%c\n",num);
}
if(!feof(inputFile)){
printf("error");
return 0;
}
}
My goal is the get an array of the second line, based on the amount of values in the first line.... essentially, we want an array with 8 values, that stores {12, 48, ....}