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;
}
Discussion:
110 comments Page 7 of 11.
Bhavya kp said:
10 years ago
It refers second variable. And also gives output from second word of referred variable.
Nani said:
1 decade ago
What is the value of *ptr and ptr in the program? please give me the explanation?
Swati said:
1 decade ago
What does **ptr and ***ptr means? why do we use them? can someone please explain?
Ramya said:
9 years ago
Are we not supposed to use *** to access "pink" by p?
Isn't it should be ***p+1?
Isn't it should be ***p+1?
Baby Noon said:
1 decade ago
Actually I am not getting this. Could anyone explain me this in an easy manner?
Jassi said:
1 decade ago
Why we declared p as triple pointer. And then equated it with ptr i.e. ptr=p;.
Saurav said:
1 decade ago
Can anybody tell me when to use single * and when to use double and triple *?
Rana said:
1 decade ago
Plese help me in how pointer point p with example showing ** means and ++p.
Hai said:
1 decade ago
Plese help me in how pointer point p with example showing ** means and ++p.
Mohan said:
6 years ago
@Sriram.
When one pointer pointing to another pointer * will be increased.
When one pointer pointing to another pointer * will be increased.
(2)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers