我有这个问题,不知道原因
我有这个结构
typedef struct
{
Int32 frameID;
Int32 slotIndx;
Int32 symNumber;
} recControlList;
recControlList *recControlListPtr;
数据类型是 typedef。
调用函数是:
Fun( recControlListPtr);
有趣的声明是
Fun (recControlList *recControlListPtr);
syntax error : missing ')' before '*'
如何将结构作为指针传递给函数?请帮忙
最佳答案
在声明 Fun() 之前需要有 struct 声明和 typedef。
如果所有这些都在同一个文件中,那么它们只是顺序错误。如果结构在不同的文件中声明,则需要在函数原型(prototype)之前#include。
编辑:那么关于你的第二个问题......
关于c - 传递结构以在 C 中用作参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4096056/