delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/11/13:35:19

From: "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How do I set up predefined structures?
Date: Tue, 10 Aug 1999 13:38:47 -0400
Organization: Nortel Networks
Lines: 36
Message-ID: <37B063A7.8D159653@americasm01.nt.com>
References: <7oo1aa$cmh$1 AT news7 DOT svr DOT pol DOT co DOT uk>
NNTP-Posting-Host: bmerhc00.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.7 [en] (X11; I; HP-UX B.10.20 9000/712)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Andrew Davidson wrote:

> typedef struct rom_double {
>     char *file1,*file2;
>     int length;
> }
>
> typedef struct rom_triple {
>     char *file1,*file2,*file3;
>     int length;
> };
>
> struct rom_map {
>     rom_double *program_roms;
>     rom_triple *tile_roms;
>     rom_double *sprite_roms;
> };
>
> As an example of a simple predefined structure:
>
> struct rom_map game1_map = {
>     {    /* program roms */
>         {"progrom1a","progrom1b",65536},
>         {"progrom2a","progrom2b",65536},
>         {NULL, NULL, 0}
>     },
>

    The problem arrises because your members of the rom_map struct are
POINTERS and your initializing them with values, not addresses.

--
     -Rolf Campbell (39)3-6318



- Raw text -


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