Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Explain the o/p of following program.
C++
int main()
{
    int a[2][3]={5,10,15,20,25,30};
    int (*p)[2][3]=&a;
    printf("%d\t",***(p+1));
    printf("%d\t",***p);
    printf("%d\t",**(*p+1));
}



OUTPUT:-


Garbage,5,20;
Posted
Updated 30-Oct-15 18:25pm
v2
Comments
George Jonsson 31-Oct-15 0:26am    
Didn't your mother teach you to ask nicely?
Or is she still spoon feeding you?
We don't take orders here.
Garth J Lancaster 31-Oct-15 2:09am    
we don't take orders here ? so "I'll have fries with mine" will be ignored :-)

As I assume, this a homework; it won't entertained here.
If you expect us to do your homework, that's not going to work. There's a pretty good reason behind this: "You won't be learn anything, if you expect others do your work for you".
I'd read this first: Code Project Quick Answers FAQ[^]

-KR
 
Share this answer
 
No.
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

If you can't work it out using the debugger, then do it on paper: write down "locations" and "addresses" and see exactly what everything should contain. It's pretty obvious if you think a little about what is happening.
 
Share this answer
 
Comments
Garth J Lancaster 31-Oct-15 2:07am    
I see someone 1-voted you - bleh, Ive tried to counter back with a 5
Patrice T 31-Oct-15 2:48am    
another 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900