Activity 18.6.
Remember the binary 2’s complement representation of integers?
Using the
sizeof()
function, please find out how many bits in memory are used to store an integer on our system (recall that the sizeof() function returns the number of bytes), then use that information to compute the largest integer that can be represented on our system (assuming binary 2’s complement is used). Next, please print out this integer as well as the number you obtain when you add 1 to this integer.If you are done, please modify your code to perform similarly for the data types
short
and long
.When you are done, please paste your code into the code submission box below: