Lets say I am reading a file with 2 lines of numbers. Forexample lets say that t
ID: 3617443 • Letter: L
Question
Lets say I am reading a file with 2 lines of numbers. Forexample lets say that the lines are:2 2 2 2 1 1 1 2
I understand how I would read these lines from a file andstore them into an array...
for(i = 0; i < 4; i++) fscanf(*fpt, "%d", first[i]);
and I understand how I would read the second line...
for(j = 0; j < 4; j++) fscanf(*fpt, "%d", second[i]);
What I need to know is how I would go about adding the 2corresponding values in the arrays. Would I create a third array? third[4] = first[i] +second[j]?
I'm sure that isn't correct, but that is essentially what Ineed. so that when I print out the third array I would get: 33 3 4
2 2 2 2 1 1 1 2
I understand how I would read these lines from a file andstore them into an array...
for(i = 0; i < 4; i++) fscanf(*fpt, "%d", first[i]);
and I understand how I would read the second line...
for(j = 0; j < 4; j++) fscanf(*fpt, "%d", second[i]);
What I need to know is how I would go about adding the 2corresponding values in the arrays. Would I create a third array? third[4] = first[i] +second[j]?
I'm sure that isn't correct, but that is essentially what Ineed. so that when I print out the third array I would get: 33 3 4