Sumedh

What does *p++ do? Does it increment p or the value pointed by p?




The postfix "++" operator has higher precedence than prefix " * " operator. Thus, *p++ is same as *(p++); it increments the pointer p, and returns the value which p pointed to before p was incremented. If you want to increment the value pointed to by p, try (*p)++.




Copyright © 2002 - 07 Sumedh K