*name
in
ab
is a pointer to a single struct of type
nest
. It's
not a pointer to an
array of structs of type
nest
. So
(name+i)
(in the last two
for
-loops) is invalid -- unlike
(p+i)
, which is valid, because
*p
is a pointer to an
array of structs of type
ab
.
You simply need to change this
(p+i)->(name+i)->c
to this:
(p+i)->name->c