unsigned integer?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Sat Mar 10 18:08:27 EST 2007
More information about the Python-list mailing list
Sat Mar 10 18:08:27 EST 2007
- Previous message (by thread): unsigned integer?
- Next message (by thread): unsigned integer?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
En Sat, 10 Mar 2007 16:26:08 -0300, Paul Rubin <"http://phr.cx"@NOSPAM.invalid> escribió: > "Jack" <nospam at invalid.com> writes: >> Also, if I have an int, I can convert it to unsigned int in C: >> int i = -3; >> int ui = (unsigned int)i; > > I just tried it: > > main() { > int i = -3; > unsigned int ui = i; > printf("%d\n", ui); > } > > prints -3. What do you want the conversion to do? If you want > the absolute value, use abs(). Try again with "%u". Passing i or ui makes no difference, both push the same value on the stack. C relies on the format string to interpret the arguments. -- Gabriel Genellina
- Previous message (by thread): unsigned integer?
- Next message (by thread): unsigned integer?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list