Gate2019 cs Q34

0. Consider the following C program:

 int main(){
 int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5},
 *ip=arr+4;
 printf(ā€œ%d\nā€, ip[1]);
 return 0;
 }
 The number that will be displayed on execution of the program is ___________ .

Note – Numerical Type question

  • Option : A
  • Explanation :

    Initially ip pointer is pointing at (arr+4) or skipping starting first 4 position.

    Now in the printf system call, 1 more position is to skip, So it will point to (arr+5) or skip 5 position from starting:
    Hence, printf will print value at 6th position, i.e., 6 will printed.
    So, option (A) is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *