Question: In the for loop below, the test condition is simply the value 0 . How many times does each part of the loop (init, test,
In the for loop below, the test condition is simply the value 0 . How many times does each part of the loop (init, test, body, and update) execute in this case? int 1; for (i=42;0;1=1+1){ \} printf ("1 is 8d ,1); (a) Initialization ( 1=42) executes once, as always. The test () also executes once. Neither the body (the print f ) nor the update (i=1+1) executes at all. (b) All four parts--the initialization (i=42), the test (), the body (the print f ), and the update (i=1+1) - execute exactly once. (c) Initialization (i=42), the test (), and the body (the print f ) execute exactly once, but the update (1= i+1 ) does not execute at all. (d) Initialization (i=42) executes once, as always. The other three parts-the test ( ), the body (the printf), and the update (1=1+1)-execute an infinite number of times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
