Casting and Ranges of Variables

AP Computer Science A· difficulty 4/5

<code>char c = '5'; int v = c - '0';</code> — v is

  • A

    0

  • B

    53

  • C

    5

    check_circle
  • D

    53.0

Explanation

'5' = 53, '0' = 48; 53 - 48 = 5.

Want 10 more like this — adaptive to your weak spots?

Related questions