Consider the following code segment in C++. How many times for loop will be…
2018
Consider the following code segment in C++. How many times for loop will be repeated? int main() { int f = 1; for (; f; ) cout << "f = " << f++ << "\n"; return 0; }
- A.
10 times
- B.
Not even once
- C.
Repeated forever
- D.
Only once
Attempted by 133 students.
Show answer & explanation
Correct answer: C
Answer: Repeated forever