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.