CS140 Midterm Exam - October 5, 2004 - Page 5


Question 5

Behold p5.c:

main()
{
  int a[10];
  int i;
  int *ip;
  int **ipp;

  for (i = 0; i < 10; i++) a[i] = i;

  ip = &a[3];
  ipp = &ip;
  

  *ip = 11;
  **ipp = 21;
  ip++;
  *ip = 31;
  **ipp = 41;

  printf("0x%x 0x%x 0x%x\n", a, &ip, &ipp);
  
  for(i = 0; i < 10; i++) printf("%d ", a[i]);
  printf("\n");

  printf("0x%x\n", ip);
  printf("0x%x\n", ipp);
  printf("0x%x\n", &a[0]);
  printf("0x%x\n", a[1]);
}

Suppose the first line of p5's output is:

0xbffff9b0 0xbffff9e0 0xbffff9e4

What is the rest of the output?