C中结构中的类型

dri*_*ker 2 c struct

在本文中:http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/language/ref/clrc03defst.htm

句子是什么意思"在C中,结构成员可以是任何类型,除了"函数返回T"(对于某些类型T)

感谢所有的答案!

Geo*_*che 5

在C中没有成员函数 - 您可以将函数指针指向成员,但不能在结构中声明或定义函数:

struct X {
    int f(); // illegal in C
    int g() { return 42; } // same here
    int (*h)(); // pointer to function, fine
};
Run Code Online (Sandbox Code Playgroud)