I am a noob at programming. I just wanted to ask what is wrong with the following code:
scanf(\"%i\", &battlechoice);
printf(\"BCHOICE WAS:%i\\n\", batt
You're confusing the assignment operator =
with the equals operator ==
. Write this instead:
if (battlechoice == 4)
And so on.
Some C programmers use "Yoda conditionals" to avoid accidentally using assignment in these cases:
if (4 == battlechoice)
For example this won't compile, catching the mistake:
if (4 = battlechoice)