0

I vaguely remember that the order of the volatile keyword has influence on wether you want the pointer to the array to be volatile or the contents itself. If I want the content to be volatile, do I need to write:

volatile short Array[];

or

short volatile Array[3];
Maestro
  • 9,046
  • 15
  • 83
  • 116

2 Answers2

3

Either will do. It is the difference between

short volatile * ptr; /* pointer to volatile short */

and

short * volatile ptr; /* volatile pointer to short */

that matters.

const behaves the same way.

user694733
  • 15,208
  • 2
  • 42
  • 68
0

Both of them will work fine. Order of specifiers doesn't matter.
Read this answer for more detailed explanation.

Community
  • 1
  • 1
haccks
  • 104,019
  • 25
  • 176
  • 264