c++ - Unsigned int reverse iteration with for loops -


I repeat the Ierator variable as a code in a for loop as 0 unsigned int Want me, and i i & gt; You can not compare to -1, , as you do if it was signed int for

  (unsigned int i = 10; I & lt; = 10; -i) {...}   

But it seems very vague because it relies on numerical overflow of unsigned integer up to 10.

Perhaps I have no clear head, but what is a better way to do this ...

Disclaimer: This is just a simple use The case is, the upper limit of 10 is trivial, it can be anything, and i should be an unsigned int .

You

 for  (unsigned int j = n; Comes from  n-1  to  0 .    / div> 

Comments