int val = 5;
printf(\"%d\",++val++); //gives compilation error : \'++\' needs l-value
int *p = &val;
printf(\"%d\",++*p++); //no error
Could
The expression ++val++ is the same as (++val)++ (or perhaps ++(val++), anyway it's not very relevant). The result of the ++ operator is not the variable, but the value, and you can't apply the operator to a value.
The expression ++*p++ is the same as ++(*(p++)). The result of p++ is the value, but the result of *(p++) is a memory location, which the ++ operator can be applied to.