can you explain q.5 of the first quiz please?
Programming fundamentals quiz 1
Hello @divs.mili,
The output of this question depends upon the datamodifiers:
-
Let’s say you assign -2 to an unsigned integer, then for 32 bits int it will results in 2^32 - 2
It would be 2^16 - 2 for short unsigned integer
Similarly, for long long unsigned integer it would be 2^64 - 2
And for signed integer, it will be -2. -
As an unsigned type cannot store the negative sign, thus the compiler converts it into an above mentioned unsigned representation.
-
It’s not a necessity to mention “int” as these datatype modifiers are for int only.
Hope, this would help.
Give a like, if you are satisfied.