Thread Closed

question about pointers in C.

 
Share Thread Thread Tools
Oct13-07, 08:50 PM   #18
 

question about pointers in C.


Quote by neurocomp2003 View Post
yes postfix and prefix...i can never remmeber if the post/pre imply the ++ or p

++p will increment the pointer and then perform the operation you ask it

and
p++ will increment the pointer after performing the opreation you ask it

you can always try
x=++p; printf("...",*x); printf("%p",x);
x=p++; printf("...",*x); printf("%p",x);

in C: printf("%p",x); is your friend unless you know how to use a debugging program.
Those are the exact same since the ++ is in a completely different expression from the printf call.
 
Thread Closed
Thread Tools


Similar Threads for: question about pointers in C.
Thread Forum Replies
C Pointers explained! Programming & Comp Sci 4
Pointers and arrays question. Programming & Comp Sci 3
Coding a Bubble Sort routine using a pointer array Programming & Comp Sci 4
New and looking for pointers. General Discussion 0
Need some pointers Introductory Physics Homework 21