How do you pass a two-dimension INT array between functions?
Posted on 2004-10-26
I have forgotten the simple C method for passing an array of INTs between functions - and I'm not near my library where I could look it up without shame. So here we go:
I have a two-dimension array, playerBoard, that describes a 20x20 playing board:
...and I need to send it to a function (actually, quite a few functions) to initialize it to -1's, and later to place playing pieces, display the results to an ASCII terminal, that sort of thing. At present, the preferred method is to make the int array global, and let everybody/everything have a crack at it. I'm looking for a more secure (data-wise) method to pass the information back and forth. (Dopey me, *I* know that the data stays in the same place, that a pointer to the location is all that gets passed - but it's all lost in the antiquity -and chaos - of age...)
Does anybody have any suggestions? (Just thought I'd ask...)