
- Forum
- Programming Talk
- C and C++
- Reason for Output
Reason for Output
This is a discussion on Reason for Output within the C and C++ forums, part of the Programming Talk category; I have a C program as for(i=1;0;i++) { printf("Hello"); } I thought there would be no output but I found ...
-
Reason for Output
I have a C program as
for(i=1;0;i++)
{
printf("Hello");
}
I thought there would be no output but I found in the book I studied the answer given as Hello printed once. Is this a printing error or can anyone explain the reason for the same.
-
The reason is the for loop gets executed once and the next time when it gets incremented only the condition fails. So Hello is printed once.

Reply With Quote





