5 not an identifier; it is an integer literal.
Standard C literally states that 5[a] is just syntactic sugar, which should be equivalent to *(5 + a) . In C, there is no requirement that the first operand of the + operator be an identifier, so the code works very well.
6.5.6, my emphasis is:
To add, both operands must be of arithmetic type, or one operand must be a pointer to the full type of the object, and the other must have an integer type .
source share