0
Why memset works for -1 but not for 5?
3 Réponses
+ 4
memset sets each byte to the byte n.
An int has 4 bytes on a non 16-bit machine so it gets the byte "0000 0101" (5) 'encoded' in it 4 times.
"0000 0101 0000 0101 0000 0101 0000 0101" = 84 215 045
It just so happens to work with -1 because
"1111 1111 1111 1111 1111 1111 1111 1111" = -1
0
Thanks Dennis