delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/24/21:51:01

From: Brian Osman <osmanb AT rpi DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: quest: initializing many structs
Date: Thu, 20 Feb 1997 10:55:37 -0500
Organization: Rensselaer Polytechnic Institute, Troy NY, USA
Lines: 24
Message-ID: <330C73F9.4D4@rpi.edu>
References: <5ehr3s$3s3 AT mn5 DOT swip DOT net>
Reply-To: osmanb AT rpi DOT edu
NNTP-Posting-Host: darkwing.stu.rpi.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ville Sjoberg wrote:
> 
> struct cubestruct
> {
>         struct pointstruct point[1][1][1];
> };
> 
> void cube_init (struct cubestruct *cube)
> {
>         cube->point[1][1][0] = {+1, +1, -1};
>         cube->point[1][1][1] = {+1, +1, +1};
> };
> 
> ----------------------------------------------
> Vilhelm "Ville" Sjoeberg

Your struct declaration only makes the arrays with one element.
So, only cube->point[0][0][0] is defined. Make it:

struct pointstruct point[2][2][2];

Got it?

Brian

- Raw text -


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