Q:

What are the values of i and d after each assignment

0

What are the values of i and d after each assignment?

int i; double d;

(a) d = i = 3.5; 

(b) i = d = 3.5;

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>

int main() {
  int i;
  double d;
  d = i = 3.5;
  std::cout << d << ' ' << i << std::endl;  // 3 3
  i = d = 3.5;
  std::cout << d << ' ' << i << std::endl;  // 3.5 3

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now