I am having trouble assigning a char string to a char array

后端 未结 1 1288
情深已故
情深已故 2020-12-22 05:47

This is what I have now.

void insert(char Table[][81], char Key[81]){
    int index;
    index = search(Table, Key); 
    // This is another function used to         


        
相关标签:
1条回答
  • 2020-12-22 06:24

    You cannot assign arrays but you can use strcpy() or memcpy() instead:

    if (Table[index][0] == '\0')
        memcpy(Table[index], Key, sizeof(Key));
    else
        printf("ERROR: Key already in Table\n");
    
    0 讨论(0)
提交回复
热议问题