Another Pointer Example

#include <stdio.h>

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
   Output for the 2 sections
**/ 

  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

  Output for this function
**/ 
}



void f3(int **y, int *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

**/

  *y = z;

/** What is the value of each of the following at this point

  &y
  &z
  y
  z
  *y
  *z
  **y

**/
  Output for both sections of this function

}