Question discussion

Which of the following is true about the for loop in C?

359270Medium DSSSB TGT Computer Science 0 replies 0 views
0
Which of the following is true about the for loop in C?
  • AA for loop cannot be nested inside another for loop.
  • BThe condition in a for loop is optional, and it can result in an infinite loop if omitted.
  • CA for loop must always have all three components: initialization, condition, and increment/decrement.
  • DThe increment/decrement part of the for loop is mandatory.
Correct answer: B

Explanation

The for loop's condition can be omitted (for(;;)), which gives an infinite loop.

Discussion 0

Nobody has replied yet. Start the discussion!