所以我有一个叫做contactos的结构,我想创建一个新的结构,但是我得到了一个'分配给数组类型的表达式 new-> name = str1;'在所有str(str1,str2,str3)中。
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;
}