Rebinding through a pointer to a pointer

A C program selects and updates two integer readings using the following local variables. All variables remain alive throughout the code.


C
int low = 12;
int high = 27;
int *p = &(low);
int *q = &(high);
int **slot = &(p);


Initial pointers connect slot to p, p to low, and q to high.


The program then executes these statements in order:


C
*slot = q;
**slot += 5;
q = &(low);
*q += **slot;


Find the final values of low and high. Enter each as an exact integer; the readings have no physical units.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Pointers Questions: