我无法将char字符串分配给char数组

这就是我现在拥有的。

void insert(char Table[][81], char Key[81]){ int index; index = search(Table, Key); // This is another function used to find an empty 'slot' // in the table if(Table[index] == '\0') Table[index] = Key; // <-- This is the line that contains some sort of error. else printf("ERROR: Key already in Table\n"); } 

它抛出的错误是:

从类型’char *’分配类型’char [81]’时不兼容的类型。

我不知道如何修复或为什么抛出这个错误。 如果有人需要我的程序中的更多信息来得出结论,请告诉我。

您不能分配数组,但可以使用strcpy()memcpy()代替:

 if (Table[index][0] == '\0') memcpy(Table[index], Key, sizeof(Key)); else printf("ERROR: Key already in Table\n");