by ghost107 on Wed Apr 15, 2015 6:15 pm
([msg=87710]see Re: difference b/t signed & unsigned decimal integer?[/msg])
unsigned is part of N(natural number), it means positive numbers(0, 1, 2, 3, ...)
signed is part of Z(integer), means positive and negative numbers (...-2, -1, 0, 1, 2...)
- %d and %i are the same and will print the numbers as integers
- %u does not work, only prints the value as signed integer(if you print %u with a negative value it will print the negative value, for example -1 will print -1 instead of the integer max value)
- %o prints the number in Octal base( if decimal is base 10, uses numbers from 0-9, the octal is base 8 uses numbers 0-7, so decimal value 8 in octal will have value of 10 )
- %x print in Hexadecimal number base 16 ( uses numbers from 0-9 and A-F, A = 10, B = 11, C = 12, D = 13, E= 14, F = 15, so total value is 0-15)
- %f prints floating points(if you print 1.25 with %f will print 1.25)
Last edited by
ghost107 on Wed Apr 15, 2015 6:42 pm, edited 4 times in total.