2013-01-14 143 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