title: In C, how to fix this warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[100]
body: <p>How to fix the warning?</p>
  <blockquote>
  <p>warning: assignment to ‘struct people *’ from incompatible pointer type ‘char *’</p>
  </blockquote>
  <blockquote>
  <p>format ‘%s’ expects argument of type ‘char <em>’, but argument 3 has type ‘char (</em>)[100]</p>
  </blockquote>
  <pre><code>/* loading user information from the file*/
      void load_file(struct people *head)
      {
      FILE *pFile;
      char line[N];
      char temp_name[100];
      char temp_username[100];
      char temp_birthPlace[100];
      char new_people[100];
      char temp_the_date_of_birth[100];
      //open the FILE
      if (pFile = fopen(&quot;facebook&quot;, &quot;r&quot;))
      {
              // reading the contents of the file line by line
              while (fgets(line, N, pFile) != NULL)
          {
              struct people *new_people = (struct people *)malloc(sizeof(struct people));
              //Temporarily saving variables read from file
              sscanf(line, &quot;%s,%s,%s,%s&quot;,&amp;temp_name,&amp;temp_username,&amp;temp_the_date_of_birth,&amp;temp_birthPlace);
              strcpy(new_people-&gt;name, temp_name) == 0;
              strcpy(new_people-&gt;username, temp_username) == 0;
              strcpy(new_people-&gt;the_date_of_birth, temp_the_date_of_birth) == 0;
              strcpy( new_people-&gt;birthPlace, temp_birthPlace) == 0;
                  // adding new people and then putting them as head at the beginning of the linked list
              new_people-&gt;next = head;
              head = new_people;
          }
          fclose(pFile);
          printf(&quot;file exists&quot;);
      }
      else
      {
          printf(&quot;file does not exist&quot;);
      }
      return;
  }
  
  //sort out users and list up their personal information along with the date of birth and birthplace
  void invite_group(struct people *head)
  {
      FILE *pFile;
      char temp_username[100];
      char temp_birthplace[100];
      char temp_the_date_of_birth[100];
      struct people *ptr;
      struct people *temp_head = malloc(sizeof(temp_head));
      *temp_head = *ptr;
  
      This ArrayList also allows users to add and sort items in the list.
      struct people *ListArray[100];
      int count = 0;
      printf(&quot;please input username who invites you\n&quot;);
      scanf(&quot;%s&quot;, ptr-&gt;username);
       while ((ptr-&gt;next) != NULL)
       {
          if(temp_username == ptr-&gt;username)
            {
              pFile = fopen(&quot;test.txt&quot;, &quot;r&quot;);
            }
              if (pFile != NULL)
              {
                  //input username, the date of birth and birthplace into the file
                  fprintf(pFile, &quot;username %s,the_date_of_birth %s,birthPlace %s&quot;, ptr-&gt;username, ptr-&gt;the_date_of_birth, ptr-&gt;birthPlace);
                  // list and display username, the date of birth and birthplace
                  ListArray[count++] = (&quot;%s&quot;, &quot;%s&quot;, &quot;%s&quot;, ptr-&gt;username,ptr-&gt;the_date_of_birth, ptr-&gt;birthPlace);
              }
              ptr = ptr-&gt;next;
      }
      return;
    }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/vRDur.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vRDur.png" alt="" /></a></p>
  <p><a href="https://i.stack.imgur.com/Fq4Kw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fq4Kw.jpg" alt="" /></a></p>