code style.  I'd move 'int i;' to here at the start of this block.  it doesn't need setting to 0 either since it's initialized below.