![]() |
![]() |
![]() |
![]() |
![]() |
|
Before you go on, recall that switch views characters as a type of
integer. Accordingly, you can use a particular character in a character
array in place of an integer:
char* industry_name (struct trade *t) {
switch (t -> description[0]) {
...
}
}
As long as you compare the first character in the description character
arraythe one encoding the industry typewith various characters,
viewed as integers, switch works just fine.