Difference between cast used in Compound literals and that done on a pointer variable?
- by Sandip
Consider the following code:
int main()
{
int *p;
++((int){5}); //compile without err/warning
&((int){5}); //compile without err/warning
++((char *)p); //Compile-time err: invalid lvalue in increment
&((char *)p); //Compile-time err: invalid lvalue in unary '&'
}
Why do the Compound Literals do not…