title: C token loop segfault issue
body: <p>So sort of new to C and I am trying to make a listener so that User has to press enter twice to completed typing there input. Then split by the new line and run all the data through a loop and send them through my functions. </p>
  
  <p>I am not sure what i am doing wrong but when the loop right under "<code>//segfaulting</code> at loop" in the code is commented out it runs fine but when I uncomment it and have my call to "<code>//   assemble(ftemp);</code>" commented it out it is segfaulting so i know it here just dont know what. Valgrind says the below if that helps at all.</p>
  
  <p>Thanks In Advanced Pete.</p>
  
  <pre><code>==14639== Invalid read of size 1
  
  ==14639==    at 0x4E7754C: ____strtod_l_internal (strtod_l.c:608)
  
  ==14639==    by 0x4011F8: main (in /home)
  
  ==14639==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
  
  ==14639== Process terminating with default action of signal 11 (SIGSEGV)
  
  ==14639==  Access not within mapped region at address 0x0
  
  ==14639==    at 0x4E7754C: ____strtod_l_internal (strtod_l.c:608)
  
  ==14639==    by 0x4011F8: main (in /home)
  
  ==14639==  If you believe this happened as a result of a stack
  
  ==14639==  overflow in your program's main thread (unlikely but
  
  ==14639==  possible), you can try to increase the size of the
  
  ==14639==  main thread stack using the --main-stacksize= flag.
  
  ==14639==  The main thread stack size used in this run was 8388608.
  
  ==14639== HEAP SUMMARY:
  
  ==14639==     in use at exit: 0 bytes in 0 blocks
  
  ==14639==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
  
  ==14639== All heap blocks were freed -- no leaks are possible
  
  ==14639== For counts of detected and suppressed errors, rerun with: -v
  
  ==14639== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>int main(int argc, char * argv[]) {
  
  printf("Please Enter In Float (Hit Enter Twice To Exicute)\n" );
  #define MAXLENGTH 1000
  char Input_string[MAXLENGTH];
  int ilop = 0;
  for(;;++ilop)
  {
      Input_string[ilop] = getchar();
      if (ilop &gt; 0 &amp;&amp; Input_string[ilop] == '\n' &amp;&amp;
   Input_string[ilop-1] == '\n') break;
  }
  Input_string[ilop] = 0;
  
   char *pch;
  //  printf ("Splitting string \"%s\" into tokens:\n",Input_string);
  pch = strtok (Input_string,"\n");
  float ftemp = atof(pch);
  //printf("price:, %f\n\n",ftemp);
  
  assemble(ftemp);
   //segfaulting at loop
  while (pch != NULL)
  {
   pch = strtok (NULL, "\n");
   ftemp = atof(pch);
     printf("price:, %f\n\n",ftemp);
  //   assemble(ftemp);
   }
  
  
   return 0;
   }
  </code></pre>