Q. Which of the following parts of the for loop can be eliminated in C?
β
Correct Answer: (D)
All of these
Explanation: Syntax of for loop:
for(init, condition, increment){
}
Inside the initialization statement (init), any of the three init or condition or increment can be eliminated i.e., all are optional. The loop can work without them also.
for(init, condition, increment){
}
Inside the initialization statement (init), any of the three init or condition or increment can be eliminated i.e., all are optional. The loop can work without them also.