3 ms·
Yes, and there's another inconsistency here as well. Arrays and pointers into arrays are accessed with the same syntax: char a[3], *pa = a; ... a[0] ... p
by ScottBurson 10y ago
Yes, and there's another inconsistency here as well. Arrays and pointers into arrays are accessed with the same syntax:
char a[3], *pa = a;
... a[0] ... pa[0] ...
In contrast, with a struct, you have to know which one you have and use the correct operator:
struct { int x; } s, *ps = &s;
... s.x ... ps->x ...
To be consistent, they could either have made '.' work in both cases, or forced you to write things like '(*pa)[0]'.