Q:

Which, if any, of the following assignments are invalid? If they are valid, explain what they do

0

Which, if any, of the following assignments are invalid? If they are valid, explain what they do.

int i = 0, &r1 = i; double d = 0, &r2 = d;
(a) r2 = 3.14159;
(b) r2 = r1;
(c) i = r2;
(d) r1 = d;

All Answers

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

int main() {
  int i = 0, &r1 = i;
  double d = 0, &r2 = d;

  r2 = 3.14159;  // d = 3.14159
  r2 = r1;  // d = i
  i = r2;  // i = d
  r1 = d;  // i = d

  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