No, it's not OK to increment an array. Although arrays are freely convertible to pointers, they are not pointers. Therefore, writing a++
will trigger an error.
However, writing
char *p = a;
p++;
is fine, becuase p
is a pointer, with value equal to the location of a
's initial element.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…