double myData16 0 int i 0 FILE fp fp fopencdatafile2txt

double myData[16] = { 0 };

int i = 0;

FILE *fp;

fp = fopen(\"c:\\\\data\\\\file2.txt\", \"r\");

if (fp != NULL)

{

double val;

while (fscanf(fp, \"%lf\", &val) == 1)

{

myData[i] = val; i++;

fclose(fp);

}

If the data file contains between 5 and 16 values, which one of the following statements is FALSE?

a. Any array elements that are not populated inside the while loop will contain the value 0.

b. The value of variable i will contain the number of values successfully stored into the array.

c. The next call to fscanf, after reading the last value from the file, will return a value other than 1.

d. Nothing will be stored by the while loop into any element of the array

Solution

The statement D is false. The while loop will store all the values in the file to the array. The while loop condition will hold until all the values in the file are read.

double myData[16] = { 0 }; int i = 0; FILE *fp; fp = fopen(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site