title: C language, where is the segmentation fault?
body: <p>here is the function where im getting the segmentation fault</p>
  
  <pre><code>void searchcity()
  {
      struct city *ptr=citylist;
      printf("Which city would you like me to search?: ");
      scanf("%s",searchedcity);
      //  printf("%s",searchedcity);
      while(ptr)
      {
          if(!strcmp(searchedcity,ptr-&gt;name))
              printf("name= %s, statecode = %s,population = %s,region = %s,zipcode =     %s\n",ptr-&gt;name,ptr-&gt;statecode,ptr-&gt;population,ptr-&gt;region,ptr-&gt;zipcode);
          else
              printf("sorry, couldnt find that city");
          ptr=ptr-&gt;next;
      }   
  }
  </code></pre>
  
  <p>not sure what can be causing this to happen.</p>