When I compile my project I get the error ("assignment makes integer from pointer without a cast array = NULL"). I don't understand why it works in the if statement and not in the else statement.
FILE *fp;
int i,j,m,n;
char citemp;
if (!(fp = fopen(trainingsInputFile, "r"))) {
perror("Datei konnte nicht gelesen werden");
}
else {
i = 0;
j = 0;
n = 0;
char *carray = (char*)malloc(sizeof(char) * 20);
while (!feof(fp)) {
citemp = getc(fp);
if(citemp != ';'){
if(citemp != ','){
carray[j] = citemp;
j++;
}else{
trainingsInputArray[n][i] = atof(carray);
for(m = 0; m < j; m++){
carray[m] = NULL;
}
j = 0;
i++;
}
}else{
n++;
i = 0;
}
}
}
fclose(fp);
Error: environment.c:21: warning: assignment makes integer from pointer without a cast [-Wint-conversion] carray[m] = NULL;
while(!feof(fp))is always wrong. - user2736738