以下代码生成不兼容的指针类型错误和警告:控制到达文件名函数中非空函数的结尾:
#include <stdio.h>
#include <stdlib.h>
int quit;
char *filename(int *);
int main ()
{
filename(&quit);
return 0;
}
char *filename(int *i1)
{
char input[16];
char *dum=(char*)malloc(16*sizeof(char));
if (dum==NULL){
printf("Memory could not be allocated \n");
}
else {
printf("Memory was allocated – remember to free\n \n");
*i1=1;
fputs("Input filename = ", stdout);
fflush(stdout);
fgets(input,sizeof(input),stdin);
printf("Filename = \"%s\"\n",input);
return i1;
}
}
我是新手,有人可以帮我解决这个错误吗?