Multiple choice technology programming languages

1)main() { static int a[]={0,1,2,3,4}; int p[]={a,a+1,a+2,a+3,a+4}; int **ptr=p; ptr++; printf(“\n%d%d%d”ptr-p,*ptr-a,ptr); *ptr++; printf(“\n%d%d%d”ptr-p,*ptr-a,ptr); *++ptr; printf(“\n%d%d%d”ptr-p,*ptr-a,ptr); ++*ptr; printf(“\n%d%d%d”ptr-p,*ptr-a,*ptr); }

  1. 123 234 340 012

  2. 111 222 333 444

  3. 111 222 444 333

  4. 012 340 234 123

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This code uses an array of pointers and a pointer to a pointer. ptr starts pointing to p. After ptr++, ptr-p=1, *ptr-a=1, **ptr=1 (value at a[1]). The operations *ptr++, *++ptr, and ++*ptr manipulate these pointers in different ways. The output 111 222 333 444 shows the progression through the array elements as the pointer is advanced through each step.