Bits/Bytes and ASCII Part 3
Answer a few questions
about what the program did (10
points)
Very Simple Questions:
- Remember the section of code:
//
Now, let's try and store an
'Illegal' value in location ch
// I say illegal because we know that signed bytes can only take on the
values:
// -27 through +27 - 1, or -128 though +127
// What happens if we try and store a number outside of that range?
ch = 211;
And Remember the output?
The outcome is
u,
decimal -45
Why is that? (Explain in detail for
full credit)
- Even when we entered a
'legal' value:
//
Now, if we were to store
the value 211 at location ch2 (an unsigned character) it should be OK
// since an unsigned character has the range 0 through 28 - 1 (0 through 255)
// Let's try it
ch2 = 211;
We still got strange output:
The outcome
is
u, decimal 211
Why is that? (Explain in detail for full credit)
Make sure to submit your answers
via the Submission Page by the Date Due
(See Course Schedule)
This page was last updated on
07/06/05
|