我有以下代码:
typedef struct
{
int a;
int b;
} Hello;
typedef struct
{
char c;
int d;
} World;
Hello hello[10][10];
World world[5];
然后我有以下功能:
void getInfo(Hello hello_p[][10], World* world_p)
{
// Here I suppose to get the size of pointer to the array of hello and world
sizeof(hello_p);
sizeof(world_p);
}
void getHello(Hello (** hello_p)[10])
{
hello_p = hello;
}
void getWorld(World ** world_p)
{
world_p = world;
}
然后我调用这个函数:
Hello (*hello_p)[10] = NULL;
World *world_p = NULL;
getHello(&hello_p);
getWorld(&world_p);
getInfo(hello_p, world_p);
然后在 getInfo 函数中,我可以获得指向hello
and数组的指针的大小world
吗?