Computer Science, asked by Rajwinderbrar1, 8 hours ago

Char data types has a range of - 128 to 127. define a char type variable with value 129 and check what the output will be.​

Answers

Answered by gindu1704
1

Answer:

-127 is stored as 2's compliment of 127

127 is 01111111 in binary

2's compliment=(1's compliment of a number) + 1

therefore, 2's compliment of 127(01111111) is 10000001(-127).

And 10000001 is 129:: Therefore when you give 129 to a char variable, compiler takes it as negative number 127.

Explanation:

pls mark me as brainliests answer

Answered by 039harshithav
0

Answer:

if we assign +128 to char variable then it is converted into -128 because of binary equivalent(10000000-first bit tells sign). Binary equivalent of 129 is 10000001

Explanation:

hope it helps you

please mark me as brainliest

Similar questions