What is the output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output?

#include<stdio.h> int main() { int i=1; for(printf("1") ; !printf("2"); printf("3")) { printf("\n hii"); } return 0; }

18th Sep 2017, 7:37 AM
Vishanth Tiwari
Vishanth Tiwari - avatar
1 Answer
+ 13
for(printf("1") ; !printf("2"); printf("3")) { printf("\n hii"); } printf("1") is executed. Program checks for condition, printf("2") is executed. !printf("2") evaluates to false, the loop contents do not run, increment statement is not executed. Output: 12
18th Sep 2017, 7:51 AM
Hatsy Rei
Hatsy Rei - avatar