I have more code to this program but I dont want to display it
basically I create an array for a character to be in it, mainly y or n for yes or no, then i use an If statement to check it but it doesnt seem to be working, i got this method to work before, but I don't remember what I did, the worst part is it is very basic!
everything I try to input gives me the same answer "Didn't work did it?"
printf("Do you want to continue? [y/n]: ");
if( ans == "y")
printf("Continuing code here...\n");
printf("Didn't work did it?\n");
I even chaned ans to just
but with those I get Warning: Comparing integer to character or something
so I made it a pointer.
when I do this:
I even changed scanf to %s instead of %c, still didn't work right
printf("%c\n",ans); //it displays my character fine
printf("%s\n",ans); // it still works
something wrong with my if statement?
can someone please help me with the solution and an explanation of why my program doesn't work would be appreciated highly.