Skip to content
Related Articles

Related Articles

Improve Article

ISRO | ISRO CS 2017 | Question 80

  • Last Updated : 15 Mar, 2018

Consider the following C function




#include <stdio.h>
int main(void)
   {
    char c[ ] = "ICRBCSIT17";
    char *p=c;
    printf("%s", c+2[p] – 6[p] – 1);
    return 0;
   }

The output of the program is
(A) SI
(B) IT
(C) TI
(D) 17


Answer: (D)

Explanation: Given String = “ICRBCSIT17”
Index of I=0, C=1, R=2, B=3 and so on. Now we are making a pointer p point to character array c.
Here 2[p] = p[2] =’R’ and 6[p] = p[6] =’I’
‘R’-‘I’ = 9 and c + 2[p] – 6[p] – 1 = c + 9 – 1 = c + 8
So “17” is printed as the string.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :