C Programming - Strings - Discussion

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

int main()
{
    static char mess[6][30] = {"Don't walk in front of me...", 
                               "I may not follow;", 
                               "Don't walk behind me...", 
                               "Just walk beside me...", 
                               "And be my friend." };

    printf("%c, %c\n", *(mess[2]+9), *(*(mess+2)+9));
    return 0;
}
t, t
k, k
n, k
m, f
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
22 comments Page 3 of 3.

Abhimanyu Verma said:   2 decades ago
As we can see this is a matrix having 6+1 row and 30+1 column.

So now *(mess[2]+9)means that third row of matrix that is "Don't walk behind me...", and its (9+1)th character that is K

and *(*(mess+2)+9)) this one have the same meaning as *(mess[2]+9)bcoz a[i]=*(a+i). So has same value K.....

Swetha said:   2 decades ago
Please give us more details of solving this type of questions


Post your comments here:

Your comments will be displayed after verification.