Q:

For each of the following declarations indicate whether the object being declared has top-level or low-level const

0

For each of the following declarations indicate whether the object being declared has top-level or low-level const.

const int v2 = 0; int v1 = v2;
int *p1 = &v1, &r1 = v1;
const int *p2 = &v2, *const p3 = &i, &r2 = v2;

All Answers

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

int main() {
  int i;
  const int v2 = 0;  // v2 has top-level const
  int v1 = v2;
  int *p1 = &v1, &r1 = v1;
  const int *p2 = &v2, *const p3 = &i, &r2 = v2;  // p2 has low-level const
                                                  // p3 has both low-level and top-level const
                                                  // r2 has low-level const
  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