peiyoke
asked on
Declaration of array
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[H EIGHT][WID TH],bo[HEI GHT][WIDTH ];
short rq[HEIGHT][WIDTH],gq[HEIGH T][WIDTH], bq[HEIGHT] [WIDTH];
float rn[HEIGHT][WIDTH],gn[HEIGH T][WIDTH], bn[HEIGHT] [WIDTH];
float rq2[HEIGHT][WIDTH],gq2[HEI GHT][WIDTH ],bq2[HEIG HT][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 ?
My declaration of array is as follow:
#define HEIGHT 32
#define WIDTH 32
short x,y,ro[HEIGHT][WIDTH],go[H
short rq[HEIGHT][WIDTH],gq[HEIGH
float rn[HEIGHT][WIDTH],gn[HEIGH
float rq2[HEIGHT][WIDTH],gq2[HEI
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]
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 ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
huge float rn[HEIGHT][WIDTH], ...
^^^^^