title: C string program
body: <p>I have been given a task at school to write a program that</p>
  
  <ul>
  <li>Reads three strings</li>
  <li>Stores the third string in dynamically allocated memory</li>
  <li>Print out the last 4 letters of the first word alphabetically.</li>
  </ul>
  
  <p>Here is the program I have so far. The strings are all stored in different variables, making them hard to sort. If anyone could give me a hand and help me finish this program, I would be very grateful.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
     char word1[101];
     char word2[101];
     char* word3;
     char buffer[101];
     scanf("%s", word1);
     scanf("%s", word2);
     scanf("%s", buffer);
     word3 = (char *) malloc(strlen(buffer)+1);
     strcpy(word3, buffer);
  
     return 0;
  }
  </code></pre>