int num = 65537;
char p = (char)num; //char = 1;
Whats going on here?
Is it p=num%(127+128)-1
or p=num%256 or something else?
I need to know why p is equal to 1.
thanks!
since 65537 is 00000000 00000001 00000000 00000001 in binary, but the char type has only 1 byte, the last byte is considered for the char value, wich is 00000001 = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With