delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/28/22:56:05

From: DavMac AT iname DOT com (Davin McCall)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: HELP ! (returning structures)
Date: Wed, 29 Sep 1999 02:05:49 GMT
Organization: Monash Uni
Lines: 51
Distribution: world
Message-ID: <37f173b9.2534667@newsserver.cc.monash.edu.au>
References: <7srkeu$3kh$1 AT tron DOT sci DOT fi>
NNTP-Posting-Host: damcc5.halls.monash.edu.au
X-Trace: towncrier.cc.monash.edu.au 938570724 26238 130.194.198.138 (29 Sep 1999 02:05:24 GMT)
X-Complaints-To: abuse AT monash DOT edu DOT au
NNTP-Posting-Date: 29 Sep 1999 02:05:24 GMT
X-Newsreader: Forte Free Agent 1.1/32.230
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Something like this:

struct DATE GetDate(void)
{
  struct DATE x;
  x.day_of_week = GetDayOfWeek();
  x.year = ...
  ....
  return x;
}

Davin.

On Wed, 29 Sep 1999 02:57:07 +0300, "stefan fröberg"
<traveler AT netti DOT fi> wrote:

>How can functions return whole structures ?
>
>Example:
>
>struct    DATE
>{
>    unsigned char    day_of_week;
>    unsigned short    year;
>    unsigned char    month;
>    unsigned char    day;
>}
>
>extern    struct DATE    GetDate(void);
>
>int    main(void)
>{
>    struct   DATE    today;
>    today = GetDate();
>    printf("%u\n",today.day_of_week);
>    printf("%U\n",today.year);
>    printf("%u\n",today.month);
>    printf("%u\n",today.day);
>}
>
>"Just a traveler..."
>traveler AT netti DOT fi
>
>
>
>
>

__________________________________________________________
       *** davmac - sharkin'!! davmac AT iname DOT com ***
my programming page: http://yoyo.cc.monash.edu.au/~davmac/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019