所以,在编译一个我不知道如何修复的 C 文件时,我收到了一些警告。
第一个警告来自以下代码:
char line[100];
char* carbonCopy;
char *currentWord;
wordlist *theList = malloc(sizeof(wordlist));
theList->head->string = NULL;
word *fromFile = malloc(sizeof(word));
while(fgets(line,99,file)){
if(line != NULL){
carbonCopy = line;
while((currentWord = strsep(&line, " ")) !=NULL)
{
malloc(strlen(currentWord)*sizeof(char));
fromFile->string = currentWord;
fromFile->next = malloc(sizeof(word));
警告指出:
从不兼容的指针类型传递“strsep”的参数 1 [默认启用]