The last one doesn't involve any increment of any pointer.
Two of them aren't even legal code.
Code:
$ gcc -std=c99 -Wall main.c
main.c: In function ‘main’:
main.c:21:10: error: lvalue required as left operand of assignment
(*p)++ = j;
^
main.c:25:10: error: lvalue required as left operand of assignment
++(*p) = j;
You can always write code to test ideas you know.
Code:
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
void dump ( char *s, int *arr, int *p, int n ) {
printf("%s results in elements=",s);
for ( int i = 0 ; i < n ; i++ ) {
printf("%d ", arr[i]);
}
ptrdiff_t pd = p - arr;
printf("\np is pointing to the %td element\n",pd);
}
int main()
{
int arr[10] = { 0 };
int *p = arr;
int j = 3;
*(p++) = j;
dump("*(p++) = j",arr,p,10);
// (*p)++ = j;
// dump("",arr,p,10);
*(++p) = j;
dump("*(++p) = j",arr,p,10);
// ++(*p) = j;
// dump("",arr,p,10);
return 0;
}
$ gcc -std=c99 -Wall main.c
$ ./a.out
*(p++) = j results in elements=3 0 0 0 0 0 0 0 0 0
p is pointing to the 1 element
*(++p) = j results in elements=3 0 3 0 0 0 0 0 0 0
p is pointing to the 2 element