title: combining 2 strings in another string alphabetically
body: <p>I want to write a recursive function that combines 2 string into one string that is in alphabetic order , the 2 strings are only small letters and in ascending alphabetical order . Example :
  s1: "aegiz"  s2: "abhxy"  s3: "aabeghixyz" </p>
  
  <p>I am still new to recursive functions and to C in general and I think that this can be solved in a better way than what I did...</p>
  
  <p>my code so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>#include &lt;stdio.h&gt; 
  #include &lt;conio.h&gt;
  #include &lt;stdlib.h&gt;
  #define N 50
  char *combinealph(char *str1, char *str2, char *str3);
  void main()
  {
   char *str1[N], *str2[N],*str3;
   int length;
   printf("Enter first string:\n");
   gets(str1);
   printf("Enter second string:\n");
   flushall(1);
   gets(str2);
   length = strlen(str1) + strlen(str2);
   str3 = (char*)malloc((length+1)*sizeof(char));
   printf("The combined string :\n");
   puts(combinealph(str1, str2, str3));
   getch();
  }
  
  char *combinealph(char *str1, char *str2, char *str3)
  {
   if (*str1 == '\0' &amp;&amp; *str2 != '\0')
    strcpy(str3, str2);
    return str3;
   if (*str1 != '\0' &amp;&amp; *str2 == '\0')
    strcpy(str3, str1);
    return str3;
   if (*str1 == '\0' &amp;&amp; *str2 == '\0')
     return '\0';
  
   if (*str1 &gt;= *str2)
   {
    strcpy(str3, str1);
    return strcat(*str3, combinealph(str1 + 1, str2, str3+1));
   }
   if (*str1 &lt; *str2)
   {
    *str3 = *str2; 
    return strcat(*str3, combinealph(str1, str2 + 1, str3+1));
   }
  }</code></pre>
  </div>
  </div>
  </p>