C : Convert signed to unsigned -
actually i've (probably) "simple" problem. don't know how cast signed integer unsigned integer.
my code :
signed int entry = 0; printf("decimal number : "); scanf("%d", &entry); unsigned int uentry= (unsigned int) entry; printf("unsigned : %d\n", uentry); if send unsigned value console (see last code line), signed integer.
can me?
thanks lot!
kind regards, pro
printf("unsigned : %u\n", uentry); // ^^ you must use %u specifier tell printf runtime uentry unsigned int. if use %d printf function expect int, reinterpret input signed value.
Comments
Post a Comment