Xref: utzoo comp.lang.c:16603 comp.sources.wanted:6558 comp.unix.xenix:5154 Path: utzoo!attcan!uunet!sco!md From: md@sco.COM (Michael Davidson) Newsgroups: comp.lang.c,comp.sources.wanted,comp.unix.xenix Subject: Re: Looking for memcpy() and memcmp() routines in C Message-ID: <697@fiasco> Date: 28 Feb 89 22:17:40 GMT References: <463@sunset.MATH.UCLA.EDU> <20598@tiger.oxy.edu> Reply-To: md@sco.COM (Michael Davidson) Organization: The Santa Cruz Operation, Inc. Lines: 19 In article <20598@tiger.oxy.edu> bagpiper@oxy.edu (Michael Paul Hunter) writes: >If your compiler will pass structures you can create a routine like the >one which follows to copy structures. > >struct foo CopyStruct(struct foo Thing) >{ > return(Thing) ; > } If your compiler is capable of handling function arguments and return values which are structures it almost certainly implements structure assignment, so what you want is as simple as: struct foo x; struct foo y x = y; The only way to compare structures in a portable manner is to compare corresponding members of the structures one by one.