InterviewSolution
Saved Bookmarks
| 1. |
Find the error in the following c++ statement : for(c=1;c++) |
|
Answer» for (INITIALIZATION; CONDITION; increment/decrement){//body}So, the error comes in the syntax, at condition.Explanation:To avoid this WITHOUT PLACING the condition, we can leave the condition specification empty as follows.for(C=1;;c++){//body}Where, as in between ;; , we didn't place any condition, the loop runs infinite times. |
|