r/programminghelp • u/bigDissapointment12 • Feb 20 '24
C Weird string issue
Hey, I'm experiencing this weird issue with my code. I'm still fairly beginner, but I need to make a project for one of my University classes. I decided to make a "hangman" like game. It works fairly well except for the one issue that when the user inputs a letter to guess, no matter what it will always output "Incorrect guess" for the first letter. I'm not exactly sure why, I've tried figuring it out for a few hours now but I just cant crack it.
Any help is appreciated, thanks!
1
Upvotes
View all comments
Show parent comment
1
u/bigDissapointment12 Feb 20 '24
I was testing with the word “guess”. When I then input a letter like ‘s’, the last 2 will say correct, and the first 3 will say incorrect. However, when I try with the letter ‘g’, it says all are incorrect, even though g is the first letter. I tried using different var types like %c and with and without the &. I could not get it to work.