问题描述
我最近开始研究结构体和指针,但是对于 struct
的设计,我还没有完全理解.我了解 struct
的声明,即 typedef struct Alias
及其内容,但我不了解 Get_noAllyp
和 *no_getOf代码> 在语句的末尾.这些是什么?我也找不到好的来源.
I've recently started to study about structs and pointers but there is something I didn't fully understand about the design of a struct
. I understand the declaration of the struct
i.e typedef struct Alias
and its content but I don't understand Get_noAllyp
and *no_getOf
at the end of the statement. What are they? I couldn't really find a good source either.
typedef struct Alias {
char *s_a_name;
char **s_aliases;
short *s_dumr;
int s_get_sum;
}Get_noAllyp, *no_getOf; /*Here, I don't understand this one.
Where did these two variables come from?
And one of them is a pointer.*/
推荐答案
它定义了多个 typedef
,即同一事物的多个名称",而第二个是指向它的指针.
It defines multiple typedef
s, i.e multilple "names" for the same thing, while the second is a pointer to it.
第一个 Get_noAllyp
是结构的名称,而 no_getOf
表示指向它的指针.
The first one Get_noAllyp
is the name given for the struct, while no_getOf
represents a pointer to it.
即,编写no_getOf
与在函数签名或变量声明中编写Get_noAllyp *
完全相同.
I.e, writing no_getOf
is completely the same as writing Get_noAllyp *
in function signatures or variable declarations.
这篇关于如何将一个结构体定义为多个名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!