delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/13/17:02:41

From: broeker AT acp3bf DOT knirsch DOT de (Hans-Bernhard Broeker)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Code problems
Date: 13 Sep 1999 17:37:03 +0200
Organization: RWTH Aachen, III. physikalisches Institut B
Message-ID: <7rj5mv$bba@acp3bf.knirsch.de>
References: <7rbdkc$l21$3 AT perki DOT connect DOT com DOT au>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 937237027 13458 137.226.32.75 (13 Sep 1999 15:37:07 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 13 Sep 1999 15:37:07 GMT
X-Newsreader: TIN [version 1.2 PL2]
Lines: 49
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Tim Chmielewski (tchuma AT sympac DOT com DOT au) wrote:
> I know it's probably against the rules to post code here, but I can't work
> out this problem:

[...]
> CODE:

> void look_ahead(char nasties, int floor, int ty, int &gf)
> {
> char nasties[3] = nasties;

This line 147 of tot.cpp? 

> int ty = ty;
> ty = rand() % 1;
> ty = ty * 3 + 1;
> char what[10] = "";
> what = nasties[ty];

I assume this line is number 153 in tot.cpp, right?

In that case, there are at least two errors in 'tot.cpp':

> tot.cpp: In function `void print_flrrm(int, int, int, int, int)':
> tot.cpp:147: parse error before `{'

This means that in function prnt_flrrm(), at least one closing '}'
brace is missing, somewhere. gcc didn't expect a new function to begin
here, as it didn't see the previous one being ended.

> tot.cpp:153: `nasties' undeclared (first use this function)
> tot.cpp:153: (Each undeclared identifier is reported only once
> tot.cpp:153: for each function it appears in.)

This is a follow-up error from the missed start of a new function.

The other genuine error is your declaration 

	char nasties[3] = nasties;

You cannot redefine one of the functions parameters with the same
name, I think. Nor can you assign a char to a char [3] array and
expect anything sensible to come out of it.



-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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