Почему я получаю «присваивание выражению с типом массива»? - PullRequest
0 голосов
/ 14 мая 2019

Итак, у меня есть структура с именем contactos, и я хочу создать новую, но я получаю «присваивание выражению с типом массива new-> name = str1;»по всей ул (стр1, стр2, стр3).

typedef unsigned char Key;
struct contactos{
    Key *name[NAME_SIZE];
    char *mail[MAIL_SIZE];
    char *phone[TELEFONE_SIZE];
};

typedef struct contactos* Contactos;

#define key(a) (a->name)

Contactos newContacto(unsigned char *name ,char * mail, char * phone){
    char* str1;
    char* str2;
    char* str3;

    Contactos new = (Contactos) malloc(sizeof(struct contactos));

    str1=(unsigned char*) malloc(sizeof(unsigned char)*1023);
    strcpy(str1, name);
    new->name = str1;

    str2=(char*) malloc(sizeof(char)*512);
    strcpy(str2,mail);
    new->mail = str2;

    str3=(char*) malloc(sizeof(char)*64);
    strcpt(str3, phone);
    new->phone = str3;

    return new;
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...