Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The break statement of the C language interrupts (breaks) a loop, giving control

ID: 3775084 • Letter: T

Question

The break statement of the C language interrupts (breaks) a loop, giving control to the first statement that follows after the current loop statement.

Function readVector() defined below reads up to *pn int numbers into an array a from a FILE* f already open and returns in *pn the number of elements read from f:

void readVector(FILE* f, int a[], int *pn) {

   int i;

   for (i=0; i<*pn; i++) {

      if (fscanf(f, “%d”, &a[i]) != 1) {

         break;

      }

   }

   ___________

}

What is the correct statement that should replace the blank line ?

                    

*pn = i;


return i;


return *pn;


pn = i;

*pn = i;


return i;


return *pn;


pn = i;

Explanation / Answer

Option A is the right answer as the value i should be assigned to a pointer variable not as its address.

Where i is the no of integers countfrom file.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote