Yes, volatile
is required, and the right declaration is:
volatile unsigned char *my_data;
This declares my_data
to be a pointer to volatile unsigned char.
To make the pointer itself volatile, you’d need this instead:
unsigned char *volatile my_data;
And of course, both the pointer and the pointed-to data may be volatile:
volatile unsigned char *volatile my_data;
There’s no difference between C and C++.