Why does this code produce the warning?
FILE* my_open_file(char* filename)
{
FILE* fp=fopen(filename,"r");
if(fp==NULL)
{
perror("Error opening file");
return -1;
}
return fp;
}
- asdf.c: In function ‘my_open_file’:
- asdf.c:9: warning: return makes pointer from integer without a cast
fp is already a pointer, and not integer as far as I can see.