![]() |
![]() |
![]() |
![]() |
![]() |
|
Thus, there is no such data type as a string. When you hand over a string to a function, you supply a character pointer that points to the first character in that string. When you want to return a string from a function, you really ask for a pointer to the first character in that string.
For example, when you define the industry_name function, you declare
that it is to return a character pointer as follows:
char* industry_name (struct trade *t) {
switch (t -> industry) {
case food: return "Food"; break;
case trucking: return "Trucking"; break;
...
}
}