| codeback99 (6) | |
|
I want to pass int x[4][4]; to function void something(???){ } what should i put on ??? part? | |
|
|
|
| SuperStinger (29) | |||||
|
Hello codeback Im not too experienced in C, but ill do what i can to help. What you can do is pass the pointer of the array to the function, e.g.
To call the 'something' function from the main function with the array as the argument, you would do this...
Hope I was of some help, SuperStinger | |||||
|
Last edited on
|
|||||
| aiby (31) | |||
| |||
|
Last edited on
|
|||
| vlad from moscow (3108) | |
|
There are two possibilities. Either to declare the parameter as reference to a two-dimensional array or declare it as pointer to the element of a two-dimensional array that is a one dimensional array. So select either such declaration void something( int ( &a )[4][4] ); or such declaration void something( int ( *a )[4], int n ); where n - is the first dimension of the original array. | |
|
Last edited on
|
|