returning 2-D arrays from a function

1 reply [Last post]
coolgal
Offline
Last seen: 10 years 17 weeks ago
Joined: 2009-06-24
bOt Points: 70

i was  writing a c++ program wherein it was required to return a 2-D array from a function. However i was unable to ccomplish it.

Please help me out

akj_1989
Offline
Last seen: 10 years 16 weeks ago
Joined: 2009-06-24
bOt Points: 54

 Have you tried to return the base address of that array

Then you can access each element by adding the size of one element to the base address multiplied by no. of elements b/w it and the 1st element.

By default the matrix is row major.

I hope it would work.