c - What's the mistake in this code? unsigned int i; for (i = 100; i >=0; --i) printf("%d\n", i); -
this question has answer here:
- unsigned integers in c [closed] 9 answers
unsigned int i; (i = 100; >=0; --i) printf("%d\n", i); i ran code on ideone , prints until -10000
since i unsigned, >=0
using format string %d interprets signed integer when printing. view unsigned, use %u.
Comments
Post a Comment