While C syntax considers array subscripts ([]
) as symmetrical, meaning that a[i]
and i[a]
are equivalent,
the convention is to put the index in the brackets rather than the array name. Inverting the index and array name serves no purpose, and is very
confusing.
Noncompliant code example
10[P1] = 0; // Noncompliant
dostuff(i[arr]); // Noncompliant
Compliant solution
P1[10] = 0;
dostuff(arr[i]);