Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Why is this loop always executing once?
Why is this loop always executing once?
✍: Guest
for(i = start; i < end; i++);
{
printf("%d\n", i);
}
A: The accidental extra semicolon hiding at the end of the line containing the for constitutes a null statement which is, as far as the compiler is concerned, the loop body. The following brace-enclosed block, which you thought (and the indentation suggests) was a loop body, is actually the next statement, and it is traversed exactly once, regardless of the number of loop iterations.
2015-06-03, 1489👍, 0💬
Popular Posts:
Which JavaScript file is referenced for validating the validators at the client side ? WebUIValidati...
How can you write a loop indefinitely? Two examples are listed in the following code: for(;;) { ... ...
What are the five levels in CMMI? There are five levels of the CMM. According to the SEI, Level 1 – ...
How To Increment Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
How do we host a WCF service in IIS? Note: - The best to know how to host a WCF in IIS is by doing a...