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 int i;  (i = 100; >=0; --i)      printf("%d\n", i); 

i ran code on ideone , prints until -10000

https://ideone.com/1tq3yu

since i unsigned, >=0

using format string %d interprets signed integer when printing. view unsigned, use %u.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -