In this source code,
#include <stdio.h>
void test(char *a[]);
int main(void)
{
char *k[] = {"123", "4567", "89101112"};
test(k);
}
void test(char *a[])
{
++a;
++a[0];
a[1] += 4;
printf("%s\n", a[-1]);
printf("%s\n", a[0]);
printf("%s\n", a[1]);
}
Output
123
567
1112
I understand ++a; but ++a[0] and a[1] += 4; seems awkward. The single object a remembers three properties and the result is printed as above. What is the reason for this?
++a[0];anda[1] += 4;.