Is it valid in C
P = P1 + P2 - P3
U can add a integer to a pointer like P1+10 is valid but P1 + P2 is not valid. But the thing you are trying to achieve can be achieved by the following way...
P = P1 + (P2 - P3)
assuming all pointers are of same type.
It is not valid.
Since the pointer points address, if we add 2 address then resulting address may point to different segment or address. I guess this is the reason for this restriction.
I recently came to know about Restricted pointers in C. Can anyone throw some light on how and when is it used?