C Programming - Pointers - Discussion
Discussion Forum : Pointers - Find Output of Program (Q.No. 5)
5.
What will be the output of the program If the integer is 4bytes long?
#include<stdio.h>
int main()
{
int ***r, **q, *p, i=8;
p = &i;
q = &p;
r = &q;
printf("%d, %d, %d\n", *p, **q, ***r);
return 0;
}
Discussion:
35 comments Page 4 of 4.
Madhu said:
1 decade ago
If it declaired that int i,*p then
p= &i (it means p stores the address of i)
*p=value at i
same way
q= &p
**q=value at &i(it means pointer to a integer pointer)
***r= value at &i(it means pointer to a pointer to a poiter )
and it has no limit to extend this pointer to pointer so we can use number of' *'.but all are print only the value so it prints 8,8,8.
p= &i (it means p stores the address of i)
*p=value at i
same way
q= &p
**q=value at &i(it means pointer to a integer pointer)
***r= value at &i(it means pointer to a pointer to a poiter )
and it has no limit to extend this pointer to pointer so we can use number of' *'.but all are print only the value so it prints 8,8,8.
Zohra said:
1 decade ago
Well explained. Sunil.
Tarun said:
1 decade ago
@Jyothi. Explain nicely thanks for understand me.
Shashank sinha said:
1 decade ago
Thanx Jyoti
Ramya said:
1 decade ago
Here r contains ***r so it point the i pointer variable.
And q contain the ** pointer variable. And p contain the * pointer variable so it point the i pointer address value.
And q contain the ** pointer variable. And p contain the * pointer variable so it point the i pointer address value.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers