Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 In the following program how long will the for loop get executed? #include<stdio.h> int main() { int i=5; for(;scanf("%s", &i); printf("%d\n", i)); return 0; } ?->(Show Answer!)
1. In the following program how long will the for loop get executed? #include<stdio.h> int main() { int i=5; for(;scanf("%s", &i); printf("%d\n", i)); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.01 pm
During the for loop execution scanf() ask input and then printf() prints that given input. This process will be continued repeatedly because, scanf() returns the number of input given, the condition is always true(user gives a input means it reurns '1'). Hence this for loop would get executed infinite times.