Hey All,
I've been away from programming for a little bit, and could use a little help here.
Here is the code:
void showMap(const int *map);
int main()
{
int width = *ANYTHING*
int height = * ANYTHING*
int map[width][height];
*I fill the array with random values*
showMap(*map);
}
void showMap(const int *map)
{
int i;
int j;
*double for loop*
cout << map[i][j];
*end loop*
}
I run this and get:
error C2109: subscript requires array or pointer type.
I know this is probably just a small overlook on my behalf, but any help with this would be greatly appreciated.
Don't pass *map, just pass map because int[] is basically the same as int* allocated with a constant size.
If I don't pass *map into the function, I get a
cannot convert parameter 1 from 'int [5][5]' to 'const int *'
error.
I am required to use the
void showMap(const int *map, int width, int height); prototype.