Hi,
I want to pass a two dimensional array by reference to a function and then manipulate it's content in the called function.
I'm not sure about how to do it.
If you can help...
Thanks,
Edesign
Hi,
I want to pass a two dimensional array by reference to a function and then manipulate it's content in the called function.
I'm not sure about how to do it.
If you can help...
Thanks,
Edesign
Even though it was posted in the C++ programming forum, in this case you can refer to this thread on 2D arrays.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Thanks laserlight.
I followed the thread u suggested and it works, though gcc gives me warning after compilation.
Here's how my program look like
and this is the warning I get....Code:int main() { int mat[3][3]; ... ... transpose(mat); ... ... } void transpose(int (*mat)[3]) { ... }
What may be the reason?warning: conflicting types for ‘transpose’
note: previous implicit declaration of ‘transpose’ was here
Thanks
Edesign
p.s: also how should I declare it? declaring as transpose(int *[]) gives error...
You forgot the function prototype.Originally Posted by edesign
Copy and paste the first line of the function definition, adding a semi-colon at the end.Originally Posted by edesign
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)