Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

struct array function argument

I have the following code of declarations:

struct coord {
int x;
int y;
}
void rotateFig(struct coord[10][10]);

I need to implement rotateFig. I tried to start with following:

void rotateFig(struct coord[10][10] c)
{
   //code
}

I can`t compile it - probaly the way I transfer c in the function definition is incorrect .How should I transfer c using given signature. Thank you

like image 242
Yakov Avatar asked Jun 03 '26 19:06

Yakov


1 Answers

Use this definition:

void rotateFig(struct coord c[10][10])
{
   //code
}

The array is the actual parameter, so the dimensions have to come after its name, not before.

like image 95
littleadv Avatar answered Jun 06 '26 11:06

littleadv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!