title: passing argument 1 of ‘strncmp’ makes pointer from integer without a cast C programing
body: <p>I want to compare some data that the client sends to a server. Bout i have this error when I use strncmp t compare what I read from the socket and the strings I'm using to compare. Can someone tell me why is this error?</p>
  
  <blockquote>
    <p>warning: passing argument 1 of ‘strncmp’ makes
    pointer from integer without a cast</p>
  </blockquote>
  
  <p>Server:</p>
  
  <pre><code>void
  result(int sockfd)
  {
      ssize_t     n;
      char        buf[MAXLINE];
      int         temp;
      time_t      ticks;
      int         i;
  again:
      while ((n =read(sockfd, buf, MAXLINE)&gt; 0))
      {
       buf[n] = '\0';
       printf("Message Recieved:%s\n",buf);
       srand (time(NULL));
       temp = rand() % 40+1;
       printf("Ramdom es %i\n",temp);
  
       if ((strncmp (buf[0],"Axx",1) == 0) || (strncmp (buf[0],"axx",1) == 0))
       {
        snprintf(buf, sizeof(buf), "Option A choosen in %i on %.24s\r\n", temp,ctime(&amp;ticks));
        Writen(sockfd, buf, n);
       }
       if ((strncmp (buf[0],"Bxx",1) == 0) || (strncmp (buf[0],"bxx",1) == 0))
       {
        snprintf(buf, sizeof(buf), "Option B choosen in %i on %.24s\r\n", temp,ctime(&amp;ticks));
        Writen(sockfd, buf, n);
       }
       else
       {
         printf("Incorrect Input");
         Close(sockfd);
         break;
       }  
      }
      if (n &lt; 0 &amp;&amp; errno == EINTR)
      goto again;
      else if (n &lt; 0)
          err_sys("read error");
  }
  
  int
  main(int argc, char **argv)
  {
      int                 listenfd, connfd;
      socklen_t           len;
      struct sockaddr_in  servaddr, cliaddr;
      char                buff[MAXLINE];
      /*char                message[MAXLINE];*/
      char                recvline[MAXLINE + 1];
  
      listenfd = Socket(AF_INET, SOCK_STREAM, 0);
      bzero(&amp;servaddr, sizeof(servaddr));
      servaddr.sin_family      = AF_INET;
      servaddr.sin_addr.s_addr = htonl(INADDR_ANY);/*----------------------------------------------------*/
      servaddr.sin_port        = htons(5678); 
  
      Bind(listenfd, (SA *) &amp;servaddr, sizeof(servaddr));
      Listen(listenfd, LISTENQ);
      printf("EDMTS is running on 127.0.0.1, listening on port 5678\n");
      printf("\n");
      printf("Waiting for incoming connections...Press Ctrl+C to end server\n");
  
      for ( ; ; )
      {
          len = sizeof(cliaddr);
          connfd = Accept(listenfd, (SA *) &amp;cliaddr, &amp;len);
  
          /*Client connects to server*/
          printf("\n");
          printf("Connection from %s, port %d\n",
                 Inet_ntop(AF_INET, &amp;cliaddr.sin_addr, buff, sizeof(buff)),
                 ntohs(cliaddr.sin_port));
  
              result(connfd);
                  Close(connfd);
  
      }
  }
  </code></pre>
  
  <p>Thank you very much.</p>