C Programming - Pointers - Discussion

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

int main()
{
    static char *s[] = {"black", "white", "pink", "violet"};
    char **ptr[] = {s+3, s+2, s+1, s}, ***p;
    p = ptr;
    ++p;
    printf("%s", **p+1);
    return 0;
}
ink
ack
ite
let
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
110 comments Page 10 of 11.

Prashant said:   1 decade ago
If I write *(*p+1) why violet is printed ?

Danish said:   8 years ago
Best explanation, Thanks, @Piyush Prakash.

Madhav said:   1 decade ago
What is the use of static in the program?

Shalu said:   1 decade ago
I want answer of printf("%s, *--*++p+3).

Manish said:   9 years ago
Not getting, please explain me clearly.

Digvijay said:   1 decade ago
Thank you all for great explanation.

Meena said:   4 years ago
Thanks everyone for making it clear.
(2)

Kavya said:   8 years ago
Good explanation, thank you @Adeel.

Jagruti said:   9 years ago
**p+1 why that is used why **?

Binod said:   1 decade ago
I don't understand ***p step.


Post your comments here:

Your comments will be displayed after verification.