Edit: derp, free() was suppose to be outside the while loop
Hi,
When I execute this from a case switch, it prints out "Would you like to continue (y/n)") two times and then crashes when I enter a letter. What's happening?
Is it because of fgets()?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
staticconstchar filename[] = "somefile.txt";
FILE *file = fopen(filename, "a+");
char *name = malloc (256);
while(name != "n" )
{
printf("Would you like to continue (y/n)");
fgets(name, 256, stdin);
free (name);
}