Solved

# Declaration of array

Posted on 1998-08-21

I have been declaring my array in the fashion shown in the code segment below and the max size for my PC is 64x64. What's wrong with my codes? How can I increase the sizes of the arrays to 512x512? Do I have to deal with setting the buffer size or virtual memory?

My declaration of array is as follow:

#define HEIGHT 32

#define WIDTH 32

short x,y,ro[HEIGHT][WIDTH],go[HEIGHT][WIDTH],bo[HEIGHT][WIDTH];

short rq[HEIGHT][WIDTH],gq[HEIGHT][WIDTH],bq[HEIGHT][WIDTH];

float rn[HEIGHT][WIDTH],gn[HEIGHT][WIDTH],bn[HEIGHT][WIDTH];

float rq2[HEIGHT][WIDTH],gq2[HEIGHT][WIDTH],bq2[HEIGHT][WIDTH];

The way I use the array :

for (x=0;x<HEIGHT;x++)

{

for (y=0;y<WIDTH;y++)

{

Infile>>ro[x][y]>>go[x][y]>>bo[x][y];

rn[x][y]=ro[x][y]/255.0;

gn[x][y]=go[x][y]/255.0;

bn[x][y]=bo[x][y]/255.0;

rq[x][y]=ro[x][y]*15/255;

gq[x][y]=go[x][y]*15/255;

bq[x][y]=bo[x][y]*15/255;

rq2[x][y]=rq[x][y]/15.0;

gq2[x][y]=gq[x][y]/15.0;

bq2[x][y]=bq[x][y]/15.0;

}

}

Can I have an example of more efficient implementation of arrays ?