NAME structure example
/** structure definition **/
typedef struct name_struct
{
char first[16], last[16];
} NAME;
/** function prototypes **/
void fill_name(NAME *);
void print_name_lastfirst(NAME );
void print_name_firstlast(NAME );
int compare_names(NAME, NAME);
/** function definitions **/
void fill_name(NAME *person)
{
printf("\nEnter first name (maximum of 15 characters) ");
my_gets((*person).first, 15);
printf("\nEnter last name (maximum of 15 characters) ");
my_gets((*person).last, 15);
}
void print_name_lastfirst(NAME person)
{
printf("%s, %s", person.last, person.first);
}
void print_name_firstlast(NAME person)
{
printf("%s %s", person.first, person.last);
}
int compare_names(NAME, NAME)
{
/* this function should use the string compare function in string.h to
determine which name comes first alphabetically. Note, if both last names
are the same, you then need to look at the first name. */
}