The title is the warning I get when I try to run the following function
It comes from the line 32. Any help that helps me fix this problem and understand why it has arisen is appreciated.
Thanks
Code:
char * setup_mutations()
{
char *result = malloc(sizeof(char));
int i;
char c, current, string[MAX_STRING];
FILE * fp;
if((fp = fopen("mutations.txt","r"))==NULL){
printf("Mutations file not available\n");
exit(2);
}
for(i=0; i<256; i++){
//result[i] = malloc(sizeof(char));
result[i] = '\0';
}
while ( (c = fgetc(fp) ) != EOF ){
current = c;
for(c=fgetc(fp); c!=' '; c=fgetc(fp)){
}
i=0;
for(c=c; c!='\n'; c=fgetc(fp)){
string[i] = c;
i++;
}
i = current;
result[i] = string;
}
if((fclose(fp))==-1)printf("Mutations file didn't close properly\n");
return result;
};
Thanks
Comment