所以我已经有很长一段时间了,似乎无法找到问题,甚至我的老师也无法找到它。编译C时出现奇怪的错误
所以我有这个头文件:
#include <stdio.h>
#include <stdbool.h>
void print_list(void);
int delete_from_list(int iWordID);
wordData * create_list(int iWordID, char * cWord);
wordData * add_to_list(int iWordID, char * cWord, bool add_to_end);
wordData * search_in_list(int iWordID, struct wordData **prev);
void print_list(void);
typedef struct _wordData
{
int iWordID;
char * cWord;
struct _wordData *next;
} wordData;
和C文件,其中包括我这个头我有这样的功能:
wordData* create_list(int iWordID, char * cWord)
{
//printf(cWord);
printf("\n creating list with headnode as [%d] %s\n",iWordID,cWord);
wordData *ptr = (struct wordData*)malloc(sizeof(struct wordData));
if(NULL == ptr)
{
printf("\n Node creation failed \n");
return NULL;
}
ptr->iWordID = iWordID;
//char * temp = (char*)malloc(sizeof(cWord));
ptr -> cWord = cWord;
ptr->next = NULL;
head = curr = ptr;
return ptr;
}
所以,当我编译出现此错误: 名单.h | 6 |错误:在'*'标记之前预计'=',',',';','asm'或'attribute'
我在这个错误上搜索了一些awnsers,但似乎找不到帮助我的人。
请帮助:)
谁是这位老师? :-P – jedwards
让我想起我的老师lol –
哈哈我知道,thnx迈克尔伯尔。我习惯于OO编程,这是必需的。 – flexzican