What is the purpose of the “volatile” keyword appearing inside an array subscript?

The volatile keyword is used to declare an array type of a function parameter.

Here, double x[volatile] is equivalent to double * volatile x.

The cppreference says :

In a function declaration, the keyword volatile may appear inside the
square brackets that are used to declare an array type of a function
parameter.
It qualifies the pointer type to which the array type is
transformed. The following two declarations declare the same function:

void f(double x[volatile], const double y[volatile]);

void f(double * volatile x, const double * volatile y);

This syntax only valid in C language in function parameters.

Leave a Comment

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