Y
Hacker News
new
|
ask
|
show
|
jobs
by
hexo
2066 days ago
int main(void) { unsigned int n = 7; printf("%i", (-n % n)); return 0; }
this gives 4 :(
2 comments
kazinator
2066 days ago
Note that %i requires an
int
argument, not
unsigned
; you want %u.
link
Arnavion
2066 days ago
If your int is 32 bits wide, 4 is exactly what it should give.
link