Do you want the function parameter to be a reference to the array? In that case you need to specify all array dimensions and put the & in parentheses.
iniBoard(signedchar(&)[2][2]);
Note that none of the following ways of passing the array will create a copy of the array, so any of them can freely modify the array elements of the original array.
i already did that. void iniBoard(signedchar(&)board[][2],constunsignedint*,constunsignedint*,signedchar*);
heres my code.
but i get different error variable or field 'iniBoard' declared void|
i just want the 2d array on my main function to be modified so i can pass it to another func to print it
The variable name should be inside the parentheses and you also need to specify the size of the array.
signedchar(&board)[2][2]
If you don't want to specify the array size (because it could vary?) you probably don't want to pass it by reference, but instead use:
signedchar board[][2]
This is the same as
signedchar* board[2]
Both of the above is exactly the same (in this context) and what is being passed to the function is actually a pointer to the first element in the array.
i see, the var name should be also inside the () and specify the size of array but thats only if i wont change it. yes?
When you have a reference you have to mention what type the reference is referring to. The size of the array is part of the type so that's why you have to specify the size when working with references.
The second way that I showed you use pointers to the first element in the array so only the type of the array elements need to be specified in that case.