View Single Post
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 02-22-2018 , 14:21   Re: Dynamic allocation Of 2D arrays
Reply With Quote #2

I'm not sure if you're meant to have C code in SourceMod tutorials section, but regardless I'm just gonna say that I prefer using 1D array then mapping to 2D so that I don't get into the allocation aids. Just 1 malloc (size=width*height)/free and thats it.

Then to access an element at x/y you can do array[x + y*width]

Last edited by hmmmmm; 02-22-2018 at 14:21.
hmmmmm is offline