C: Volatile Arrays in C

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++.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)