2D Arrays
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.
July 18, 2001 08:52 PM
Aren''t we demanding?
This is a very basic C/C++ concept, so you might want to brush up. Anyway, here is a method to pass an array:
|
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)
There are other ways to do it. This is the most basic.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement