strange behavior of reverse loop in c# and c++ -


i programmed simple reverse loop this:

for (unsigned int = 50; >= 0; i--)     printf("i = %d\n", i); 

but doesn't stop @ 0 expected goes down far negative values, why?
see ideone sample: http://ideone.com/kkixx8

(i tested in c# , c++)

you declared int unsigned. >= 0. reason see negative values printf call interprets signed (%d) instead of unsigned (%ud).


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -