سؤال

I am trying to compare 2 arrays using a strcmp, but error shows 'passing argument (1 and 2) of ‘strcmp’ makes pointer from integer without a cast' when compiling. Does anyone know where is the mistake I make?

char    file1[MAX_MAC_ADD][BIG_NUM];
char    save_MAC[MAX_MAC_ADD][BIG_NUM];
int unique_MAC = 0;


    char temp1[16];
    char temp2[16];
    for(int i= 0; i <17; i++)
    {
        temp1[i] = file1[2][i];
    }
    for(int i = 0; i < unique_MAC+1; i++)
    {
        for(int j = 0; j <17; j++)
        {
            temp2[j] = save_MAC[i][j];
        }
    }
    //if not the same
    if(strcmp(temp1, temp2 != 0))
    {
        //copy address into save_MAC
        strcpy(save_MAC[unique_MAC], temp1);
        unique_MAC++;
    }
هل كانت مفيدة؟

المحلول

A misplaced ")":

if(strcmp(temp1, temp2) != 0)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top