Switch example
Example branches to one of two functions iff y is 32 or 90
Note that case must relate to constant, not a variable or expr.
If y is neither 32 nor 90 prints out Bye and exits.
y=getheat();
switch(y){
case 32:
cold();
break;
case 90:
hot();
break;
default
printf(“Bye!\n”)
}
Previous slide
Next slide
Back to first slide
View graphic version