2013-01-14 145 views
0

我有一个结构,里面有指针(每个指向一个char数组)。我该如何创建一个指向结构内指针之一的指针?指向结构中的指针

+2

什么语言? – 2013-01-14 08:56:40

回答

0

假设C:

struct foo {    // a struct 
    char (*a)[10], (*b)[10]; // pointers to arrays[10] of char 
}; 

struct foo x;    // create an object 
char (**p)[10];    // pointer to pointer to array[10] of char 
p = &x.a;     // point to one of the pointers inside the struct 
+1

为什么downvote? – melpomene

+0

是的,我的意思是C.忘记提及它,对不起。 – littlerunaway

+0

和thanx,你的回答完全回答我的问题 – littlerunaway