
- Forum
- Programming Talk
- C and C++
- What is the Output
What is the Output
This is a discussion on What is the Output within the C and C++ forums, part of the Programming Talk category; What will happen when a semicolon ; is placed at the end of for statement as below: for(i = x; ...
-
What is the Output
What will happen when a semicolon ; is placed at the end of for statement as below:
for(i = x; i < a; i++);
Will the above statement give error? If not what will be the outcome?
-
nothing happens! Your code runs slower.
used it to put delay in the processing, then the processors became much faster and had to find other ways.
-
the above statement wont give any error but
semicolon is a null statement.semicolon gets executed till condition satisfies
once the condition wont satisfy control comes out of for loop and the block
of for loop gets executed(only once).
if semicolon is placed where ever it is necessary it acts as a statement terminator otherwise it acts as a null statement.
-
-
Correct and will run till i<a is satisfied.
-
Sponsored Ads

Reply With Quote






