Nested if/if-else
Use braces {…} to avoid
possible confusion.
if ( course_code == 1) {
if (code < 2)
printf("Mechanics\n");
else
printf("No course\n");
}
vs.
If ( course_code == 1) {
if (code < 2)
printf("Mechanics\n");
} else {
printf("No course\n");
}
Previous slide
Next slide
Back to first slide
View graphic version