1. Engineering
  2. Computer Science
  3. write it in c programming ...

Question: write it in c programming ...

Question details
Write it in C programming !
Write a program that creates an overflow for 8-bit variables, signed and unsigned. For each type (signed and unsigned), declare a variable and store in it the largest possible value. Then, increment the variable by 1 and print it again. You should observe a wrong result. Hints: Declare your variables as unsigned char and signed char since char could be vague whether its signed or unsigned. Think about what conversion specifier to use when printing the variables (%c, %d, %u, ). The test should look like below. You should have numbers printed in place of the text in red. Testing unsigned char... Largest value: <largest value> After adding: <wrong result> Testing signed char.. . original: <largest value> After adding: <wrong result>
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution