2013-01-14 4 views
0

구조체가 있고 내부에 포인터가 있어야합니다. 각 포인터는 char 배열을 가리 킵니다. 구조체 내에서 포인터 중 하나를 가리키는 포인터를 만드는 방법은 무엇입니까?구조체의 포인터에 대한 포인터

+2

어떤 언어? –

답변

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

and thanx, 내 질문에 대한 답변이 완벽하게 – littlerunaway

관련 문제