简单的例子让你理解C语言指向指针的指针

#include <stdio.h>
#include 
<malloc.h>

typedef 
struct st
{
int x;
int y;
}
sst;

sst
* boo(sst **);

int main()
{
sst 
*p;
boo(
&p);

printf(
"x: %d , y: %d", p->x, p->y);

free(p);
return 0;
}


sst
* boo(sst **ps)
{
*ps = (sst *)malloc(sizeof(struct st));
(
**ps).x = 100;
(
**ps).y = 120;
return *ps;
}

posted @ 2008-07-22 11:36  悟水  阅读(367)  评论(0编辑  收藏  举报