In my program i have tried to increment pointer but i am not sure why that when i use *pointer++ it does nor seem to work and it returns 1 as the new value. I tried using "*pointer++" in my program like you would use a pointer as an array using *pointer=*pointer+1.
but it seems that when i use just "*pointer++" the value changes to one but when i use (*pointer)++ it works .why?

Node=(node *)malloc(num*sizeof(node));
printf("%d",Node);
Node++;
printf("%d",Node);

1 Answers

4
P__J__ On Best Solutions

*pointer++ dereferences the object and increases the pointer itself and after the sequence point it points (references) to the next object.

(*pointer)++ dereferences the pointer and increases (after the sequence point) only the referenced object and leaves the pointer not changed