puts("Type your name");
gets(name);
if(name=="exit"){
exit(0);
}
My logical conditional in if is wrong, how I can repair it?
puts("Type your name");
gets(name);
if(name=="exit"){
exit(0);
}
My logical conditional in if is wrong, how I can repair it?
Since name
is a string why don't you use strcmp
function?
if (strcmp(name, "exit") == 0)
{
exit(0);
}