G
Guest
(I tried to post this earlier, but it seems without success)
A similar question to this has been answered many times, to whit the
question applying when the index variable of a for loop is declared in
the loop header, but this time that isn't the case:
I've got a piece of code a bit like this:
#include <iostream>
#include <cmath>
for (x=0; x<digits; x++)
{
//do something dependent on the value of x
}
//Depending on the value of x after one of these
//loops, I cd do the last step better outside the loop?
What is the value of x when the loop terminates? Is it indeed digits,
as one would expect? Does it reset to 0? Could it be anything
depending on my implementation?
Thanks,
James M.
A similar question to this has been answered many times, to whit the
question applying when the index variable of a for loop is declared in
the loop header, but this time that isn't the case:
I've got a piece of code a bit like this:
#include <iostream>
#include <cmath>
for (x=0; x<digits; x++)
{
//do something dependent on the value of x
}
//Depending on the value of x after one of these
//loops, I cd do the last step better outside the loop?
What is the value of x when the loop terminates? Is it indeed digits,
as one would expect? Does it reset to 0? Could it be anything
depending on my implementation?
Thanks,
James M.