title: 'strcmp' char array in C
body: <pre><code>...
  main() {
     char **src_ip[10];
     char **dest_ip[10];
     char **lat[10];
     char *ip[20];
  
     while{
        //Read file
        //fgets();
  
        src_ip[j] = &amp;data[0];
        dest_ip[j] = &amp;data[1];
        lat[j] = &amp;data[2];
  
        int idx;
        int addip;
  
        for(idx=0; idx&lt;20; idx++)
        {
            addip = 0;
            //Check to see if the IP address is already in the array.
            if ((strcmp(*(src_ip[j]),  ip[idx]) == 0) ||
                (strcmp(*(dest_ip[j]), ip[idx]) == 0))
            {
                addip=1;
                break;
            }
            //If the IP address was already found then addip would equal 1.
            if (!addip){
                printf("new node: %s",*(ip[idx]));
            }
            else
                printf("Exist");
        }
     }
     j++;
  }
  </code></pre>
  
  <p>I want to compare char string in two 1d array - array <code>src_ip[j]</code> and <code>dest_ip[j]</code> - and insert into one array ip[idx]. For example, when I look for <code>ip[1]</code>, it will go to <code>src_ip[1]</code>, meaning that it's only referring to one array - <code>ip[idx]</code> - instead of looking separately into <code>src_ip</code> and <code>dest_ip</code>.</p>
  
  <p>There must be a problem in the code - maybe I left something out?</p>