Here are 2 pieces of code. The first has the else statement tied to the wrong IF. The first is right. My problem is I'm failing to see how the first is tied to the wrong else.
Example of right code
.
Code:
#include <stdio.h>
int main()
{
int card = 1;
if (card > 1)
card = card - 1;
if (card < 7)
puts("Small card");
else {
puts("Ace!");
}
return 0;
}
example of wrong code.
Code:
#include <stdio.h>
int main()
{
int card = 1;
if (card > 1)
card = card - 1;
if (card < 7)
puts("Small card");
else {
puts("Ace!");
}
return 0;
}