Quote:
Originally Posted by teh_pwnerer795
Code:
int i = 1;
static int time_i;
i=i+1; // This will increment 'i' by the value 1 every loop
time_i = ((i * 262) / 10000);
|
I believe you have declared the wrong variable as
static. The way it stands now,
i will be set to 1 then incremented to 2 each time through the loop, and
time_i will always be computed as 0. If you change it to say
Code:
static int i = 1;
int time_i;
instead,
i will remember its value between loops and be incremented as desired, and
time_i will do as neilsonster said...
...at least until 125 loops have occurred, after a bit more than 3.25 seconds, after which time
(i * 262) will overflow and you'll start getting negative results.