Recommended Posts

How do you pass 2d arrays to a function and how do you modify it within the function? Im working on a random map generator for my game and i can''t figure out how to use multidimensional arrays in functions. PLEASE don''t reply unless youre sure it works like you tried your idea out with VC++ 6.

You should know that using array without brackets after the array name acts as a pointer to the array. So in reality you pass a pointer to an array. Note also that when you pass an array this way, the function has no idea what dimensions it is (why I used #defines)