#include <stdio.h>
int main()
{
int arr[] = {1, 2, 3, 4, 5};
int *p = arr;
++*p;
p += 2;
printf("%d", *p);
return 0;
}
Why this code does not give any compile-time error, my doubt ++*p
is evaluated as ++(*p)
it *p
will be a constant value 1
when we do ++(1)
, which is not l-value , why does the compiler not give an error?
source
share