Ive got a problem with my code, its the 2dimentional array part. Can anyone help?
void draw_map(int x, int y)
int temp_x, temp_y;
for(temp_x=1;temp_x < x; x++)
for(temp_y = 1; temp_x < y; y++)
Well, just at a glance...
The array is local to the function. You should pass the array from main() if you want to keep it; otherwise, it gets destroyed when the function goes out of function.
Also, remember that the array starts at , so your initialization should look like this:
for(temp_x=0;temp_x < x; x++)
not: for(temp_x=1;temp_x < x; x++)
I think you did a typing mistake:
i think you meant
for (temp_y = 1; temp_x <y; y++);
If im wrong just tell me
for (temp_y = 1; temp_y <y; y++)'
Well Ive chnaged both of those, and tried defining it global but I still get the same errors
theres somthing wrong with this line
> int map[x][y];
Array sizes should be constant expressions (these are variables)
I believe if you're using a variable to define the array size you have to use the new operator to create it.
u must know the rule for array
use constants or constant variables in side the array index