astruct array[10]; will already allocate 10 instances of astruct. You should have to use memcpy to copy the contents of your local created struct instance. You should use "=" only when you work with pointers.