c - C 中的预期标识符错误

标签 c identifier

出于某种原因,我收到错误:

expected identifier or '(' before 'wordlist'

在我的头文件(以及相应的函数定义)中,这两个函数返回 wordlist 指针。

使用以下代码:

#ifndef FUNCTIONS_H
#define FUNCTIONS_H

typedef struct word{
   char *string;
   struct word* next;
}word;

typedef struct wordlist{
   word *head;
   word *tail;
}wordlist;

*wordlist populateList(FILE *file);

*wordlist encrypt(wordlist *wl, int rotation);

void toFile(wordlist *wl, char *outputFileName);

#endif

谁能告诉我为什么会这样?

最佳答案

这是因为当你声明一个指针时,星号必须跟在类型名之后,而不是在它之前:

wordlist * populateList(FILE *file);
//       ^
//       |
//      Here

关于c - C 中的预期标识符错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15869957/

相关文章:

c - 为什么可以将另一种类型的参数传递给函数?

arrays - 创建 int 数组,它是一个位字段

javascript - 'namespace' 标识符在 Javascript 中有何特殊含义?

c - 搜索方法失败

MySQL : Sharing id's between public and private tables

使用c在linux中创建具有给定名称和权限的文件

c - 通过它的 API(或扩展)识别一个分辨率在 X11 屏幕上是虚拟的

c - Hp VuGen 11.5 基本相关空白值

C++ 错误 C4430 int 假定

jquery - 如何使用 HTML5 History/State API 并保持带主题标签的超链接(文档内的链接)完好无损