complement forms for numbers. What would be printed out from the following code? signed char s = 0xE0; unsigned char u = 0xE0; printf("s = %d\n", s); printf("u = %d\n", u);
Added by Patricia C.
Step 1
The hexadecimal value `0xE0` is equivalent to `224` in decimal. However, since `s` is a signed char and `u` is an unsigned char, we need to consider how these types interpret the value. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 82 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Casting Surprises: Expression Evaluation If there is a mix of unsigned and signed values in a single expression, signed values are implicitly cast to unsigned, including comparison operations (<, >, ==, <=, >=). Examples for W=32: TMIN=-2,147,483,648 TMAX=2,147,483,647 Constant, Constant, Relation, Evaluation 0 < unsigned -1 0 < signed -1 > unsigned 2,147,483,647 -2,147,483,647 - 1 > signed 2,147,483,647U -2,147,483,647 - 1 < unsigned -1 -2 > signed (unsigned)-1 -2 > unsigned 2,147,483,647 2,147,483,648U < unsigned 2,147,483,647 (int)2,147,483,648U > signed
Akash M.
Following is some C code that declares and assigns values to a few variables. Your task is to fill in the missing values. CODE: short sa = -286; char cb = (char) sa; short sc = (short) cb; unsigned char usd = sa; unsigned short use = (cb > 1U) ? 7 : 1; short sf = SHRT_MAX + SHRT_MIN; short sg = (cb << 8) >> 1; Expression | Decimal | Hex (char) TMax | 127 | 0x7f (char) 0 | 0 | 0x00 (short) | 133 | (short) | | 0x0a77 sa cb sc usd use sf sg
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD