I am a beginner in programming and I need to find out palindromes in the first file and put them into the second one. I have a Thread 1: EXC_BAD_ACCESS (code=1, address=0x68), when I am trying to start the code
#include <stdio.h>
#include <string.h>
int main ()
{
char line[255];
unsigned long k;
int i;
int flag = 1;
FILE *file = fopen("1zad.txt", "r");
FILE *new = fopen("new1.txt", "a");
while(!feof(file) && !ferror(file))
{
fgets(line, 255, file);
k = strlen(line);
for (i = 0;i < k/2;i++)
{
if(line[i]!=line[k-1-i]){
flag = 0;
}
}
if(flag == 1){
fputs(line, new);
}
}
fclose(file);
fclose(new);
return 0;
}
it underlines "!feof", text files are available and near the program file. i have no ideas what is going wrong