Mr'Black Mr'Black - 1 month ago 4x
C Question

How to properly use array subscripting notation?

I am trying to read correctly this :


I was understanding something like :

strarray[i][++j] = 0;


strarray[i][++j] = '\0';

but is not exactly the same. How could it be written correctly as an array subscripting notation?


Using the postfix array subscripting notation,


will be


Quoting the C11 standard, chapter ยง6.5.2.1, Array subscripting

A postfix expression followed by an expression in square brackets [] is a subscripted designation of an element of an array object. The definition of the subscript operator [] is that E1[E2] is identical to (*((E1)+(E2))). [...]

In your case, you can consider E1 as strarray[i] and E2 as j.