I receive this error message:
"error C2440: '=' : cannot convert from 'char' to 'char [50]'"
when this statement:
name_sel = *name [ name_int ];
or this statement:
name_sel = name [ name_int ];
is compiled. The context for this is the declaration of an array of names (character strings) for which I attempt to have the user input an integer to correspond to a selected name, and then to have that name retrieved from the array and used as a character string further down in the program.
Following are further code elements:
#define STRLEN 50
Char *name[] =
{
"ANGIE",
"BEVERLY",
"CARLOTTA",
"DANIELLE",
"EVELYN"
};
Char name_num [STRLEN];
Char name_sel [STRLEN];
Int name_int;
Int i;
Selected Name: ", STRLEN, name_num );
printf ( "Name_number = %s\n", name_num );
name_int = atoi( name_num );
printf ( "name_int: %i\n", name_int);
name_sel = *name [ name_int ];
for ( i=0; i<5; i++)
{
printf ( "The Friend's Name is: %s\n", name[i]);
}
printf ( "Name_sel = %s\n", name_sel );
Your help is appreciated.