   Double dimension table
  How do I declare and call a function that takes a double dimension table (buff[14][45]) ?cheers !!!   
  Well, if the dimensions are known, just like you'd think: foo(int bar[14][15]). You can even do it if the last dimension is unknown: foo(int bar[14][]). You cannot, however, do foo(int bar[][]). That's because the dimensions of an array are not passed along with the array itself. The compiler would have no idea where the second row begins in the memory block used by the array.There are a few ways around this.First of all, since you generally shouldn't be using arrays (see the C++ FAQ-LITE for why), you may want to pass in a nested vector: foo(std::vector<std::vector<int> > &bar). You can access it with separated subscripts, and it'll work with any dimensions.Nested datastructures for something as simple as a grid, though, are inefficient. Professional games will instead use a 1-dimensional structure and treat it as a two-dimensional structure. In the most explicit form, they'll pass in a pointer to the array (or the 1D vector) and the width and height. Like so:void foo(vector<int> &bar, int width, int height){    // set the element at position (3,4) to "8"    bar[4*width + 3] = 8;}This avoids having extra overhead for each row and also cuts down on memory fragmentation. Commonly, that's all wrapped into a 2D array class for robustness and simplicity. If you want an n-D table you can do that too (though you lose the simplicity). See the Boost libraries for more on that.   ;  is it possible to use some pointers like for the one dimension tables?E.G :void func(int* p){  p[0]=5;} void main(){   int tab[10];   func(tab);}   ;Quote:Original post by jolyqris it possible to use some pointers like for the one dimension tables?E.G :void func(int* p){  p[0]=5;} void main(){   int tab[10];   func(tab);}Yes.- xeddiex   ;Quote:Original post by xeddiexQuote:Original post by jolyqris it possible to use some pointers like for the one dimension tables?E.G :void func(int* p){  p[0]=5;} void main(){   int tab[10];   func(tab);}Yes.- xeddiexi was expecting an example...;  You just gave yourself an example.   ;Quote:Original post by Anonymous PosterYou just gave yourself an example.no i did not. it's a single dimension table...i'm telling that because i've tried to do the same with a two dimensions table but i've got some bugs... that's why i need an example in order to check if my syntaxe is correct...   