title: How to read a string from user input in C, put in array and print
body: <p>I'm fairly new to C and I've read a few chapters of a C book I have and now I have to make an assignment but I am all confused hope someone can help me out.</p>
  
  <p>I have to read 2 strings from user (char arrays) input with a max length of 100 characters and convert them to capital letters and print them out with a newline \n after each word.</p>
  
  <p>Until now I have this:</p>
  
  <pre><code>int main() {
  char chars[100];
  int i = 0;
  char str1;
  char str2;
  int j = 0;
  
  scanf("\n %c", str1);
  scanf("\n %c", str2);
  
  
  while (str1[i] != '\0') {
  
      chars[i] = str1[i];
      toupper(chars[i]);
      printf(chars[i]);
      i++;
  
  }
  
  while (str2[j] != '\0') {
  
      chars[j] = str2[j];
      toupper(chars[j]);
      printf(chars[j]);
      j++;
  
  }
  
  
  return 0;
  }
  </code></pre>
  
  <p>after it takes the 2 inputs from user, it says stops running and says run failed.</p>