error message

L

L K

I got error message
"not declared here(not in a function)"
could you give me any sugestion, what it is,
#include <stdio.h>
#include<math.h>
#include<complex.h>
#define XSIZE 1000
#define YSIZE 1000
main()
{
double complex EE[XSIZE][YSIZE];
..
..
..
..
}
 
J

Joona I Palaste

L K said:
icq#32588048
thanks a lot

You have a bloody nerve, haven't you? Is your time somehow more valuable
than ours? How much are you paying us again?

--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"A friend of mine is into Voodoo Acupuncture. You don't have to go into her
office. You'll just be walking down the street and... ohh, that's much better!"
- Stephen Wright
 
R

Richard Bos

L K said:
I got error message
"not declared here(not in a function)"
could you give me any sugestion, what it is,

I strongly doubt that that is the actual, literal error message you got.
Please post literal error messages, not cryptic parts of it.
#include <stdio.h>
#include<math.h>
#include<complex.h>
#define XSIZE 1000
#define YSIZE 1000
main()

(It's better style to declare this as int main(void), btw. It's not
illegal the way you've done it, but overly terse. In C99, the int is, in
fact, compulsory, but you're apparently using C89 - although in that
case said:
{
double complex EE[XSIZE][YSIZE];

What you probably got is something along the lines of "This object is
too large to be defined as an automatic variable inside a function".
Compilers need not support objects larger than 65536 bytes. This object
is clearly larger - it's one million double complexes, which is probably
eight million bytes.
One solution is to declare it at file scope (i.e., outside any function)
or static - some implementations adhere to the 64k byte limit for
automatic block scope ("local") variables[1], but allow file scope
("global") or static objects to be larger.
The one really portable solution is to break this up. Allocate an array
of XSIZE pointers to double complex (ca. 4000-8000 bytes), then
separately allocate XSIZE arrays of YSIZE each and point the array at
them. Since each separate object is only about 8000 bytes, this is quite
safe. It is more work, though, and you'll need to remember to free all
this allocated memory.

Richard

[1] for implementation-dependent reasons having to do with the stack.
 
R

Richard Bos

L K said:
icq#32588048
thanks a lot

You're welcome. Post here, read answers here, and what makes you think
we all have ICQ in the first place?

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,815
Members
47,361
Latest member
RogerDuabe

Latest Threads

Top