Multiple choice

If a C program contains the following declarations long ix; double dx; the data type of the expression ((int)dx) + ix is

  1. double precision

  2. double

  3. long integer

  4. integer

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The expression casts dx to int first, then adds long ix. In C's type promotion rules, when int and long are combined in an arithmetic operation, the int is promoted to long, and the result is long integer.