vendredi 19 août 2016

What is the purpose of static keyword in array parameter of function like "char s[static 10]"?

While browsing some source code I came across a function like this:

void someFunction(char someArray[static 100])
{
    // do something cool here
}

With some experimentation it appears other qualifiers may appear there too:

void someFunction(char someArray[const])
{
    // do something cool here
}

It appears that qualifiers are only allowed inside the [ ] when the array is declared as a parameter of a function. What do these do? Why is it different for function parameters?

Aucun commentaire:

Enregistrer un commentaire