for(i=N-1; i>=0; i--)
The alternative is to use the so-called goes-to operator: for (i=N; i --> 0;). But this actually relies on the postincrement semantics, which is a huge wart.
for(i=N-1; i>=0; i--)