Double Pointer

Joined
Apr 2, 2008
Messages
1
Reaction score
0
Hi,

I have got confused with pointer arithmetic.

char **p;
printf("%d\n",p++);

Result is 4.

Can anyone please explain to me in detail how so.

Regards
Soko
 
Joined
Apr 21, 2008
Messages
3
Reaction score
0
First of all, you should not use a pointer unless you initialize it.
In the given code, you have just declared the pointer but not initialized it.
So when you'll access p (either as 'p' or 'p++') you will get memory location that is pointed by p, which in this case is random value...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top