本文介绍了在C中使用指向未命名结构的指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
类似的东西有什么用
typedef struct
{
int field_1;
float field_2;
}*T;
在C
中?
由于struct
是C
中的数据类型,因此将存储有关T
指向的数据类型的信息以及如何正确初始化声明为T var
的变量var
的信息.
Since a struct
is a datatype in C
, where the information about the datatype pointed by T
is stored and how to correctly initialize a variable var
that is declared as T var
?
推荐答案
T
是指向该结构的指针的别名.结构本身不是类型,但T
是.
T
is an alias for a pointer to the structure. The structure itself is not a type, but T
is.
T
不会存储在任何地方,而是存储在类型的编译器内部表中.
T
is not stored anywhere but in the compilers internal tables for types.
您可以像使用它
T myVariable = malloc(sizeof(*myVariable));
这篇关于在C中使用指向未命名结构的指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!