volatile void * ptr;
Is ptr volatile or points to volatile location .
ptr
volatile
volatile location
Thus, the actual doubt: The same applies to the above declaration, since it applies with the const qualifier?
const
A little explanation will help me a lot.
This is a pointer to volatile data. If the pointer itself should be volatile and not the data it points to, you should use:
void * volatile ptr;
So yes, it works the same as the const modifier.
A Microsoft Explanation :
The volatile keyword indicates that the value associated with the subsequent name can be changed using actions other than actions in the user application.
The volatile keyword is useful for declaring objects in shared memory that can be accessed by several processes.
Both const and volatile are type classifiers (they are the only type classifiers in C). The syntax for their use is identical.