title: C Programming How to read a string into an array and print it back out properly?
body: <p>I'm in the process of learning C and I am going through the book "C Programming: A Modern Approach, 2nd Edition". I am on Chapter 8 programming project 6 if anyone has the book. </p>
  
  <p>The project wants me to create a program that takes a message from the user as input, make the message upper case, change some of the characters to numbers, and then print it out. I got the program to work with the example message(Hey dude, C is rilly cool) but I'm not sure how to get the program to handle a message of any length without using a variable array or dynamic array because the book hasn't went that far yet. Any help would be appreciated.</p>
  
  <p>My code below</p>
  
  <pre><code>/* Translates a message entered by the user into BIFF speak */
  
  #include &lt;stdio.h&gt;
  
  #define SIZE ((int) (sizeof(message) / sizeof(message[0])))
  
  int main(void)
  {
          char message[25];
          int i;
  
          for (i = 0; i &lt; SIZE; i++)
                  message[i] = 0;
  
          printf("Enter message: ");
          for (i = 0; i &lt; SIZE; i++)
                  scanf("%c", &amp;message[i]);
  
          for (i = 0; i &lt; SIZE; i++) {
                  if ((message[i] &gt;= 'a')  &amp;&amp; (message[i] &lt;= 'z'))
                          message[i] = message[i] - 32;
                  switch (message[i]) {
                          case 'A':
                                  message[i] = '4';
                                  break;
                          case 'B':
                                  message[i] = '8';
                                  break;
                          case 'E':
                                  message[i] = '3';
                                  break;
                          case 'I':
                                  message[i] = '1';
                                  break;
                          case 'O':
                                  message[i] = '0';
                                  break;
                          case 'S':
                                  message[i] = '5';
                                  break;
                  }
          }
  
          printf("In B1FF-speak: ");
          for (i = 0; i &lt; SIZE; i++) {
                  printf("%c", message[i]);
          }
          printf("!!!!!!!!!!\n");
  
          return 0;
  }
  </code></pre>