C Programming - Strings - Discussion

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

int main()
{
    static char s[25] = "The cocaine man";
    int i=0;
    char ch;
    ch = s[++i];
    printf("%c", ch);
    ch = s[i++];
    printf("%c", ch);
    ch = i++[s];
    printf("%c", ch);
    ch = ++i[s];
    printf("%c", ch);
    return 0;
}
hhe!
he c
The c
Hhec
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
34 comments Page 3 of 4.

Gowtham said:   1 decade ago
Can anyone explain the difference between i++[s] and ++i[s] ?

Pallavi said:   1 decade ago
Can anyone explain the difference between i++[s] and ++i[s] ?

Ajay said:   9 years ago
Guys! can you tell me the difference between ++i and i++?

Uday said:   1 decade ago
In frist printf statement how 'ch' is get the value 104?

Ravli said:   1 decade ago
I didn't understand it clearly can anyone explain it?

KHUSHBOO said:   1 decade ago
I don't understand it can anyone explain it clearly.

Wikiok said:   1 decade ago
++i[s] <-> ++(i[s]) <-> ++(s[i])

Chetan said:   3 years ago
Thanks for the explanation @Tarlika.

Nikhil said:   1 decade ago
How does an exclamation mark come?

Vinaya said:   8 years ago
How hhe! came? Please explain me.
(2)


Post your comments here:

Your comments will be displayed after verification.