关于结构体的一点疑惑
程序代码:
好久没有接触c语言了,偶尔看到一个关于结构体的程序,代码如下:其中有两个函数,我明显觉得函数func2比函数func1要简洁,更容易懂,但为什么很多代码上要用函数func1这种形式,形参要用指针的指针,不是更难懂了吗? 难道是我忘了什么重要的东西?
#include <stdio.h>
#include <stdlib.h>
typedef struct temp
{
int e;
}*TEMP;
void func1(TEMP *x)
{
printf("(*x)->e=%d\n",(*x)->e);
printf("x=%d\n",x);
}
void func2(TEMP x)
{
printf("(x)->e=%d\n",(x)->e);
printf("x=%d\n",x);
}
int main()
{
TEMP m=(TEMP)malloc(sizeof(struct temp));
m->e=5;
func1(&m);
func2(m);
return 0;
}









