0

2D Arrays

Why do we have to write columns of an array to a function parameter? If we pass columns why do we not pass rows of the array to the function? And what happens when I pass an array as a parameter to a function? Do the function take a copy of the array or ..?

22nd Nov 2017, 7:28 PM
Yusuf
Yusuf - avatar
1 Answer
+ 4
It does not make a copy of the array, it makes a copy of the address of the array To pass arrays (let's say of int), you can do like that : void foo(int ** matrix, size_t rows, size_t columns); PS : size_t is equivalent to unsigned long
22nd Nov 2017, 7:50 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar