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 9 of 11.

SelvaKarna said:   9 years ago
How to print white?
black?
pink?

Can any one tell me?

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

Prasanth said:   8 years ago
Thank you @Radhakrishna.

Travy said:   8 years ago
Please, tell me, why we are using **p+1 in printf? What's the concept?

I know it will print ink but what's the use of using **p instead of p+1?

Here we have set p=ptr, someone please help me out.

Vasu said:   8 years ago
If we want to print **++*__p what will be the answer? Please explain it.

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

Spartacus9621 said:   8 years ago
Why we use static? Can anybody explain me the use of static?

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

Swati said:   8 years ago
Thank you @Adeel.

Anitha said:   8 years ago
find the output
int s[]='hold';
*s='C';
print f("%s",s);


Can anyone please answer this question?


Post your comments here:

Your comments will be displayed after verification.