C Programming - Pointers - Discussion

Discussion Forum : Pointers - Find Output of Program (Q.No. 15)
15.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    printf("%c\n", 7["IndiaBIX"]);
    return 0;
}
Error: in printf
Nothing will print
print "X" of IndiaBIX
print "7"
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
43 comments Page 5 of 5.

Sathya said:   2 decades ago
Thanks Shamini.

Shamini said:   2 decades ago

printf("%c\n", 7["IndiaBIX"]);


It is printing the 7th character of the string "IndiaBIX".

I-0,
n-1,
d-2,
i-3,
a-4,
B-5,
I-6,
X-7.

Sathiya said:   2 decades ago
How does it takes 7th character("X") from IndiaBIX?

7["IndiaBIX"] shall we define like this?


Post your comments here:

Your comments will be displayed after verification.