Behaviour when assigning int to char

Just checking: When I assign an int to a char, does the char just take the lowest 8 bits from the int? My tests say yes. I'm just looking for some more confirmation and perhaps a general rule - haven't been able to find anything concrete on the net.

Thanks.

Nick.
I think so too.
since char has only 8 bits it can't take all of int's bits.
also since bits are copied from right to left that naturay lead to copy of only right most 8 bits
(0-7).

other bits are thrown away just like if you would assign long long int to short int

in that case 16 lowest bits gets copied and other 48 bits are going to die.

also right most bit or lowest bit is the first number bit just like number 6 is the first number inside number 649;
here number 6 is let's say like a first "bit"
Topic archived. No new replies allowed.