Supposing that y
is declared as
volatile unsigned short int y = -x;
(or an equivalent), and that the value of y
is initially different from 5, you can define
unsigned const volatile short int *p = &y;
This will satisfy the requirements as you presented them, though it imposes conditions you did not specify. In addition to those explicitly given above, it assumes that the fact that you require changes in response to changes in y
, but do not mention changes in response to changes in x
means that the pointed-to value in fact does not need to respond to changes in x
.
Of course, I'm inclined to think that this doesn't at all represent what you really mean. That cannot be implemented in C. Pointers refer to locations in memory, but the value of an expression such as x + y
does not reside in memory.