Q:

Explain each of the following definitions. Indicate whether any are illegal and, if so, why

0

Explain each of the following definitions. Indicate whether any are illegal and, if so, why.

int i = 0;

(a) double* dp = &i;
(b) int *ip = i;
(c) int *p = &i;

All Answers

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

int main () {
  int i = 0;

  //double *dp = &i;  // Error: `dp` can only hold pointer to `double`
  //int *ip = i;  // Error: a pointer can only hold address to object
  int *p = &i;  // OK

  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