auto increment loop not working

6v6gt:
It is not nice to update a for loop control variable in the for loop

timer=0;

There is absolutely nothing wrong with updating the variable within the for loop, and there are many valid reasons for doing so. But, in this instance, it begs the question - Why not use a while or do loop instead, since the end condition of the for will likely never be true...

Regards,
Ray L.