title: How to read an array up till the new line '\n'?
body: <p>So I'm passing an string into this function, where the length of the array is at a default of 50. </p>
  
  <p>I input the string using this   </p>
  
  <pre><code>void inputDNA(char *dnaSequence)
  {
      printf("Enter the sequence.");
      scanf("%s", dnaSequence);
  }
  </code></pre>
  
  <p>So I figured /n would be in the last position of the array if its less than 50. So I have this for loop...</p>
  
  <pre><code>for(i = 0; i&lt;length || dnaSequence[i] == '\n'; i++)
      {
          switch(dnaSequence[i])
          {
              case 'A': aCount++;
              break;
              case 'a': aCount++;
              break; //do this for g,c,t but for readability I removed them for this post.
  
              default: 
              {
                  printf("Invalid Base %c\n", dnaSequence[i]);
                  break;
              }
          }
      }
  </code></pre>
  
  <p>To read the string and count all a,g,t,c but print out any invalid bases. It does this till it finds the /n or it reaches the end of the array. It does it correctly for the string I entered, but then it just throws in random characters from the rest of the array for the last half and calls them all invalid if they are. </p>
  
  <p>So just to illustrate what I'm talking about, here it is in action. <a href="http://i.imgur.com/cYXDYjy.png" rel="nofollow">Image</a></p>
  
  <p>Any help?</p>