title: Using the scanf() function
body: <p>I intend to modify each other letter of a particular string. But for the purposes of this program none of that occurs. So far I've grabbed a string from the user and stored it in <code>userinput</code> and intend to print it.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main(void) {    
  char userinput[256] ="";
  printf("Enter somthing to change:\n");
  scanf("%s", &amp;userinput);
  printf("%s\n", userinput);
  
  int k = 2; // This is just here to do something every time k is even
  int j = strlen(userinput);
  for (int i = 0; i &lt; j; i++) {
  
      if(k % 2 == 0) {
          printf("%s", userinput[i]);
          k++;
      }
      else {
          printf("%s", userinput[i]);
          k++;
      }
  }
  
  }
  </code></pre>
  
  <p>The <code>strlen()</code> function however does not work on the <code>userinput</code>. I figure this is because <code>strlen()</code> is supposed to take the address of the first char of a string and then iterate until reaching a null char but scanf doesn't actually create a null char.
  I couldn't figure out a way of adding the <code>'\0'</code> after the string without first knowing the length of the string.</p>
  
  <p>How would I go about accessing the length of a stored character sequence if it's stored in an array?</p>