Why use address of first element of struct, rather than struct itself?

Solution 1:

Instead of that:

memcpy(&l.a, &inp->a, sizeof(foo_t));

you can do that:

memcpy(&l, inp, sizeof(foo_t));

While it can be dangerous and misleading, both statements actually do the same thing here as C guarantees there is no padding before the first structure member.

But the best is just to copy the structure objects using a simple assignment operator:

l = *inp;

Why would one want to use this style?

My guess: ignorance or bad discipline.

Solution 2:

Nobody should do that. If you rearrange struct members you are in trouble.

Solution 3:

One wouldn't. If you ever moved a in the struct or you inserted member(s) before it, you would introduce a memory smashing bug.