Mail Archives: djgpp/2001/03/23/06:31:45
From: | "Daniel Eliasson" <danieleliasson AT chello DOT se>
|
Newsgroups: | alt.comp.lang.learn.c-c++,comp.os.msdos.djgpp
|
Subject: | Extern int [][]
|
Lines: | 39
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.50.4522.1200
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200
|
Message-ID: | <_msu6.644$I81.6431@nntp1.chello.se>
|
Date: | Thu, 22 Mar 2001 19:27:54 GMT
|
NNTP-Posting-Host: | 193.150.238.248
|
X-Complaints-To: | abuse AT chello DOT se
|
X-Trace: | nntp1.chello.se 985289274 193.150.238.248 (Thu, 22 Mar 2001 20:27:54 MET)
|
NNTP-Posting-Date: | Thu, 22 Mar 2001 20:27:54 MET
|
Organization: | chello broadband
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi, I've got a little problem that I need some help with. Actually, there
are two.
Here goes:
1. In a function, I declare the following variables:
const int GRIDSIZE = 128;
int grid[GRIDSIZE][GRIDSIZE];
When I need to use it in another function, how do I get it with an extern
keyword? I've tried extern int grid, extern int grid[][] and extern int
grid[GRIDSIZE][GRIDSIZE]
The last one works, but it seems as it declares a new local variable called
grid instead of giving me access to the one I want.
How do I import it?
2. The compiler says that "storage size of `weaponCache' isn't constant"
weaponCache is declared like this:
const int MAXWEAPONS = 10;
char *weaponCache[MAXWEAPONS];
This, I suppose, is because of this error:
"ANSI C++ forbids initialization of member `MAXWEAPONS'
making `MAXWEAPONS' static"
So.. on to the next question: why won't it let me declare static variables
in a class?
Thanks in advance,
// Daniel Eliasson
-------------------
I believe information should be free.
www.gnu.org
- Raw text -