Code:
void foo(int* (* p)[10]) {}
int main()
{
int* n[10];
foo(&n);
}
I'm using Visual Studio on Windows platform.
But it's really obvious, the type.
If we look at the middle, we see it's a pointer to an array (of 10 elements here), and the type of array is the type on the left, which in this case is int*.
An example with the OP's code:
Code:
typedef struct node1 {
int cell;
struct node *prev;
struct node *next;
} box;
typedef struct node2 {
char name[10];
//cell *move;
} player;
#define i 10
void displayBoard(box* a, int cell, player* (*p)[i]){} //how can I pass p properly to this function?
int main()
{
player* p[i];
displayBoard(0, 0, &p); //.. I will pass the array of pointers p to displayBoard
//..more codes...
}
If I use
p
instead of
&p
I get an error (or warning in C):
error C2664: 'displayBoard' : cannot convert parameter 3 from 'player *[10]' to 'player *(*)[10]'