本文共 330 字,大约阅读时间需要 1 分钟。
如果函数返回的是结构体,如下函数的tm_Compile_time
INT32 comptime;
CHAR compiletime[64];
struct tm comparetime;
ret=Getubootinfo(&comptime,&comparetime,compiletime);
INT32 Getubootinfo(INT32 *timet_Compile_time,struct tm *tm_Compile_time,CHAR *char_compiletime)
如果这样写,是错误的,指针进行了重新赋值,变了,跟外界的入参已经没有关系,最容易犯得错误
如图:
函数必须这样写才正确:这样指针并没有重新赋值,而是对内部的元素进行了赋值。