On Montag 10 August 2009, Scott Hutter wrote: > I know that you cant return a struct by value. Is there any way around > this? If I return a pointer to the struct, the values are lost upon > leaving the function. Can anyone provide an example workaround? > > Thanks > > Scott make it return a pointer, and then copy it to a local struct: memcpy(&localstruct,functhatreturnsstruct(),sizeof(localstruct)); (thats pretty much almost exactly what a compiler would do too) -- http://www.hitmen-console.org http://magicdisk.untergrund.net http://www.pokefinder.org http://ftp.pokefinder.org It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration. <Edsgar W. Dijkstra> ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Mon Aug 10 04:24:30 2009
This archive was generated by hypermail 2.1.8 : 2009-08-10 04:24:32 CEST