I am trying to pass a large 3D array to a subroutine. I would think if I pass the complete array it would fail as it would take up too much stack memory. This is what I am seeing-using gcc I get "* stack smashing detected *" when I try to run. The obvious thing to do is pass only a pointer. I believe that the somewhat arcane C syntax for this is to specify the size of the 2nd and 3d dimensions but leave the 1st undefined. Thus I would pass something like array[] [1000] [1000]. The doc is not clear to me here but my understanding is this only passes the pointer to the array. That said, I still get a "* stack smashing detected *" condition
I could probably play with pointers to pointers etc but then I could write in assembler too! Can someone tell me if there is a straight forward way to pass a "large" 3D array to a subroutine in C. (look for "peakmatx" in the attachment)
Thanks
Fritz
I could probably play with pointers to pointers etc but then I could write in assembler too! Can someone tell me if there is a straight forward way to pass a "large" 3D array to a subroutine in C. (look for "peakmatx" in the attachment)
Thanks
Fritz