Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this noncompliant code example, the programmer expects that both print statements will print the value of alpha as a charA. The first print statement prints A because the compiler applies the eighth rule from the result type determination table to determine that the second and third operands of the conditional expression are, or are converted to, type char. However, the second print statement prints 65 — the value of alpha as an int. The first matching rule from the table is the tenth rule; consequently. Consequently, the compiler promotes the value of alpha to type int.

...