Ah I see, you're right about struct assignment in C, I wasn't aware of this. I guess Lite-C is not standards conformant here then.
The correct use of memcpy would be: memcpy(&array[0], &tmp, sizeof(astruct));
Quote:
And btw, memcpy would cause the same problem with pointers as when using =, wouldnt it? Its not like it magically would know when the user wants it to really copy a pointer or whats stored at the pointed space.
Yes that's right, I didn't want to imply otherwise. But personally I think that since there is no "better" choice for the = behaviour, it should not be defined. Memcpy can then be used explicitly for a shallow copy, while a programmer defined function can be used for a deep copy. But hey, I'm not in the C standards commision, so who cares
Thanks for clarifying this.