Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有某种方法可以定义已经是其自身的唯一实例的静态结构?就像你可以用 nasm 中的 struc 关键字做的那样?
您可以使用匿名结构,如下所示:
struct { int memberA, memberB; } my_struct; my_struct.memberA = 1; my_struct.memberB = 2; printf("%d %d\n", my_struct.memberA, my_struct.memberB);