adplus-dvertising
frame-decoration

Question

What will be the output of the program ?
#include <stdio.h>
int main(void)
{
    char p;
 char buf[10]={1,2,3,4,5,6,9,8};
    p=(buf+1)[5];
        printf("%d",p);
   
    return 0;
}

a.

5

b.

6

c.

9

d.

None of the above

Posted under Strings C Programming

Answer: (c).9

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the program ?