class, 3D-Array, return style

Dear all,

maybe my post in the "Beginner" section wasn't right. Thus I linked it:

http://www.cplusplus.com/forum/beginner/28774/

Maybe my request is unprecise or complete stupid, or both ... in any case I would like to learn something new.

Thank you!
I didn't see a question in that thread. You just posted a bunch of code.

What do you want help with?


Anyway:


- you shouldn't use calloc. It makes it so you cannot have arrays of complex types. You should use new/delete instead.

- nested new is horrific. Better to simulate a multidimensional array with a 1D array. See this post: http://www.cplusplus.com/forum/articles/17108/#msg85595
Sorry, my question is after the first small code block, with an additional comment after the second one. The rest is just to see my implementation.

I use calloc to realize negative indexation like
for(int z=-1 ; z < nz+1 ; z++) array[z];

I have no idea to realized those things in 2D/3D/4D with "new" and I used C in the past ...



Topic archived. No new replies allowed.