ProgrammingHard

struct Q { int v; }; struct Q q[3] = {{5}, {1}, {3}}; struct Q *lo = q; for (int i = 1; i < 3; i++) if (q[i].v < lo->v) lo = &q[i]; printf("%d", lo->v); What is printed?

  1. A. 5
  2. B. 3
  3. C. 1
  4. D. 0

Correct answer: C. 1

lo starts at the first element, 5, and is replaced by 1 at index 1. 3 is not smaller than 1, so lo keeps 1.

More C Programming questions

Exams that ask this topic