hi
I am haveing an arrary problem, can any1 give me a hint please.
Code:
int matrix[MATRIX_SIZE][MATRIX_SIZE];
int matrix_data[4][MATRIX_SIZE][MATRIX_SIZE];
{
matrix_data[0][MATRIX_SIZE][MATRIX_SIZE] = {{0}};
matrix_data[1][MATRIX_SIZE][MATRIX_SIZE]= {{1}};
// //--------------------------------------------------------------//
// //--------------------------------------------------------------//
return matrix_data[0];
}
int trace_matrix[MATRIX_SIZE][MATRIX_SIZE];
///////////////////////////////////////////char to int//////////////
void output_program(struct prog *progp)
{
char *codep = progp->code;
int token;
while (token = *codep++)
fputs(token_table[token].name, stdout);
putchar('\n');
}
void print_matrix(void)
{ int i, j; char symbs[] = " OX";
for (i=0; i < MATRIX_SIZE; i++)
{ for (j=0; j < MATRIX_SIZE; j++)
putchar(symbs[trace_matrix[i][j]]);
putchar('\n');
}
}
in the above code i am trying to create and array wit 4 space. to store 4 maps.
[0] - random map; [1],[2],[3] are pre positioned map. (not create yet)
I am trying to only store the random map now.
Code:
int main()
{
int n;
for (n=0; n<4; n++);
//result += matrix_data[n];
printf("%d\n", matrix_data[n]);
//std::cout<< matrix_data <<std::enl;
//cout << result
return 0;
//////////////////////////////////////////////////////////////////////
{
//////////I have set it to the array zero for random generat maze///
int x;
srand(time(0));
for (x = 0; x < 300; x++) matrix_data[0][rand()%MATRIX_SIZE][rand()%MATRIX_SIZE] = 1;
printf("%d\n", 1);
{
int i; time_t start;
seed = time(NULL);
time(&start);
for (run=1; run <= NUM_RUNS; run++)
Code above is for the random map to generate food.
However the array is not working
Can any1 help me please
thanks very much