I don't tend to use Arrays when programming in C++ because I think that vectors are a lot easier to use.
The problem is that now I have to use arrays. I'm creating a game using SDL. I'm trying to create the artwork in code using pixels on the screen. So all the artwork information is stored in Multidimensional Arrays. I'm trying to create a function that will draw the bitmap on the screen but the problem is that I dont know how to pass a multidimensional array as a parameter to the function. I know the size of the bitmap that I'm passing to the function but I'm not sure how to initialise the parameters.
This is an example of the code - fail to compile
#include <iostream>
int bitmap[5][5] = {
{0,0,1,0,0},
{1,1,1,1,1},
{1,1,1,1,1},
{1,1,1,1,1},
{0,0,1,0,0}
};
void DrawBitmap(int arr[0][0], int w, int h)
{
for(int i=0;i<w;i++)
{
for(int j=0;j<h;j++)
{
if(arr[w][h] == 1)
{
// draw pixel on the screen
}
}
}
}
int main (int argc, char * const argv[])
{
DrawBitmap(bitmap, 5, 5);
return 0;
}