Re: Re: [cc65] returning structs

From: Thomas Giesel <skoe1directbox.com>
Date: 2009-08-10 12:09:46
Hi,

> Well, its not as pretty as returning a struct by value, but here's something
> of what I did:  I created a struct in the main function, then sent it into
> another function by reference (pointer).  Made the changes inside the
> function, which of course then were available back in the main function.

Correct, this is the typical, clean and fast way to do it:

void snafucate(foo* p)
{
    p->x = 42;
}

int main(void)
{
    foo f;
    snafucate(&f);
}

/Thomas


----------------------------------------------------------------------
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 12:09:55 2009

This archive was generated by hypermail 2.1.8 : 2009-08-10 12:09:58 CEST