title: Check if command line arguments are palindrome words using Threads
body: <p>Write a program that receives as arguments words. For each word from command line it creates a thread which checks if the word is palindrome. If the word is palindrome, it increments a global variable (in thread).</p>
  
  <p>This is what I did:
  It's not working because the types are not compatible in function palindrome. What can I do? Can I pass the command line arguments in other way (not by using myStruct) ?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;pthread.h&gt;
  
  int var_global = 0;
  pthread_mutex_t mtx; 
  typedef struct{
      char* word;
  }myStruct;
  
  int palindrome(myStruct aux){
      int k = strlen(aux);
      int i;
      for (i=0; i&lt;k/2; i++) {
          if(aux[i] != aux[k-i])
              return 0;
      }
      return 1;
  }
  
  void* f(void* w){
      myStruct aux;
      aux=*(myStruct*)w;
  
      if (palindrom(aux)==1){
          pthread_mutex_lock(&amp;mtx);
          var_global++;
          pthread_mutex_unlock(&amp;mtx);
      }
  }
  int main(int argc, char *argv[]){
       int i;
       pthread_t threads[argc];
       pthread_mutex_init(&amp;mtx, NULL); 
  
       myStruct s[argc];
       for (i=1;i&lt;argc;i++){ 
          s[i].word = argv[i];
          pthread_create(&amp;threads[i], NULL, f, &amp;s[i]);
       }
  
       for (i =1; i&lt;argc; ++i)
          pthread_join(threads[i], NULL);
  
       printf("the global variable has the value: %d \n", var_global);
       pthread_mutex_destroy(&amp;mtx);
  
       return 0;
  }
  </code></pre>