#include int f1(int w); int f2(int *x); void f3(int **y, int *z); int main(void) { int i = 95, j = -16; int *ptr_2_i, **ptr_2_ptr_2_i; ptr_2_i = &i; ptr_2_ptr_2_i = &ptr_2_i; /** Assume the following addresses have been assigned A1 i A2 j A3 ptr_2_i A4 ptr_2_ptr_2_i; **/ /**What are the values of the following at this point i j ptr_2_i ptr_2_ptr_2_i *ptr_2_i *ptr_2_ptr_2_i **ptr_2ptr_2_i **/ printf("\n%d, %d ", f1(i), f2(ptr_2_i)); f3(ptr_2_ptr_2_i, &j); printf("\n%d, %d\n", **ptr_2_ptr_2_i, *ptr_2_i); printf("%d\n", f2(ptr_2_i)); /**What are the values of the following at this point i j ptr_2_i ptr_2_ptr_2_i *ptr_2_i *ptr_2_ptr_2_i **ptr_2ptr_2_i **/ return 0; } int f1(int w) { return w; } int f2(int *x) { return (*x); /** Assume C1 is given to x as an address **/ /** What is the value of each of the following at this point &x x *x **/ } void f3(int **y, int *z) { *y = z; /** Assume C4 is given to y and C5 is given to z as addresses **/ /** What is the value of each of the following at this point &y &z y z *y *z **y **/ } Address Name Value --------------------------- A1 i 95 A2 j -16 A3 ptr_2_i A1 A4 prt_2_ptr_2_i A3 Values are i = 95 j = -16 ptr_2_i = A1 ptr_2_ptr_2_i A3 *ptr_2_i = 95 (what is stored in location A1) (dereference value of ptr_2_i) *ptr_2_ptr_2_i = A1 (what is stored in location A3)(dereference value of ptr_2_ptr_2_i) **ptr_2_ptr_2_i = 95 (what is stored in the location A1) (dereference value of ptr_2_ptr_2_i TWICE) Address Name Value C1 x A1 (value stored in ptr_2_i for first call) A2 (value stored in ptr_2_i for second call) Values for first call (assumes C1 assigned as address for both calls) &x = C1 x = A1 *x = 95 Values for second call (assumes C1 assigned as address for both calls) &x = C1 x = A2 *x = -16 Address Name Value C4 y A3 (value of ptr_2_ptr_2_i)(Address of ptr_2_i) C5 z A2 (address of j) Value &y = C4 &z = C5 y = A3 z = A2 *y = A1 (the value stored in A3) *z = -16 (the value stored in A2) **y = 95 (the value stored in A1) (double dereference)