foo is a struct with 5 scalar variables (A, B, C, D, F) and one array (E). What is confusing me is what f[0], f[1], and f[2] are in this context and what is happening here.
int
bar(struct foo *f)
{
f[1].C = f[0].B > f[2].C;
f[0].E[-1] = f[0].D;
f[0].A = f[1].C;
}
Are f[0], f[1], and f[2] individual structures with member variables? Can someone please explain? Thanks.
fis a pointer to the first element of an array ofstruct foo. When addressed with an array subscript (like[1], for example), the compiler computes the address of the element and dereferences it (*(f + 1)in the example).