Click here to Skip to main content
14,644,129 members
Rate this:
Please Sign up or sign in to vote.
See more:
Explain the o/p of following program.
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 :-)
Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   
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
Rate this:
Please Sign up or sign in to vote.

Solution 2

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
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100