delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/07/01:06:20

From: "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bison variable access
Date: Tue, 06 Jul 1999 09:27:23 -0400
Organization: Nortel Networks
Lines: 48
Message-ID: <3782043A.28A947D5@americasm01.nt.com>
References: <199907020051 DOT UAA06732 AT indy DOT delorie DOT com> <377C404E DOT 36E22B7 AT hotmail DOT com> <378182F5 DOT AF4797B3 AT unb DOT ca> <3781BA61 DOT A5028CFA AT hotmail DOT com>
NNTP-Posting-Host: bmerhc00.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [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

Denis Lamarche wrote:

> Yes!..that is what I meant.  Ive done that with the functions, but when
> I try to do it with the variables, my compiler (DJGPP for dos) keeps
> telling me that I cannot assign the pointer of my variable to a pointer
> because it is not constant.
>
> struct vars
> {
> char *vname;
> double *var;
> };
>
> struct vars variables[]
> = {
>   *drive,
>   *room,
>   *picture,
>   *house
>   };
>
> and this does not work.

    Well, I don't think I know what you mean.  Could you post the EXACT error message
that gcc gives you?  Your 'variables' array should be initialized as follows:

double drive, room,picture,house;

struct vars
{
char *vname;
double *var;
};

struct vars variables[]
= {
  {"drive", &drive},
  {"room", &room},
  {"picture", &picture},
  {"house", &house}
  };


--
     -Rolf Campbell (39)3-6318



- Raw text -


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