samedi 7 décembre 2019

How are integer values stored in bytes? How different format specifiers work? [closed]

Question:

https://i.stack.imgur.com/X1X36.jpg

Result:[I used visual studio code to compile]

https://i.stack.imgur.com/5bnif.jpg

In the question we are given 1 byte for character.So 128 could be stored in it. When I refer variable number with %d I get -128.

How could you justify this in binary digits? 128 could be represented as 1000 0000 in binary,How will it read it as -128?

Further When I refer with %u Why there is occurrence of 4294967168 as 1byte could not allocate such a huge number?

Aucun commentaire:

Enregistrer un commentaire