OK, well if you're sure that i is automatically set to zero, then I must be wrong. Why not add a printf statement (or cout if you prefer) to display the value, then you can prove it to me.