char getString(char *str, int length, char field[20])
{
printf(" %s: ", field);
fflush(stdin);
fgets(str, length, stdin);
str[strlen(str) - 1] = '\0';
fflush(stdin);
return *str;
}
why i can't use strcpy in this case
strcpy(newContact->fieldsValue[i], getString(newContact->fieldsValue[i], 30, listFieldsName[i]));
i want to get value of fieldName
struct newContact = {
char *fieldsName[30],
char *fieldsValue[30],
struct newContact* next;
}
char *listFieldsName = {"a", "b", "c"};