title: How to make a hex to octal converter in C
body: <p>I'm looking to make a hex to octal convert in C, and right now I'm able to convert a string from hex to binary. Now I'm looking to convert it from binary to octal. I believe that this was the simplest way.
  This is what I have for now. It's a function being called in a main program. 
  How do I go from now? I'm kind of stuck and any help would be great.
  Thanks in advance.</p>
  
  <pre><code>#include "my_lib_3.h"
  #include &lt;string.h&gt;
  #include "mrb_lib_1.h"
  #include &lt;math.h&gt;
  
  char *hex2octal(char s[]){    
  char input_string [20] = "";
  //char return_string[50] = "";
  int  num, binary_val, decimal_val = 0, base = 1, rem;
  printf("Enter a hex number:\n");
  scanf("%s",input_string);
  int i;
  for (i=0; i&lt;1; i++) { 
  switch(input_string[i]){
  case '0' :
  //    strcat(return_string, "0000");
   num = "0000";
  break;
  case '1' :
  //    strcat(return_string, "0001");
   num = "0001";
  break;
  case '2' :
  //    strcat(return_string, "0010");
   num = "0010";
  break;
  case '3':
  //    strcat(return_string, "0011");
   num = "0011";
  break;
  case '4':
  //    strcat(return_string, "0100");
   num = "0100";
  break;
  case '5':
  //    strcat(return_string, "0101");
   num = "0101";
  break;          
  case '6':
  //    strcat(return_string, "0110");
   num = "0110";
  break;
  case '7':
  //    strcat(return_string, "0111");
   num = "0111";
  break;
  case '8':
  //    strcat(return_string, "1000");
   num = "1000";
  break;
  case '9':
  //    strcat(return_string, "1001");
   num = "1001";
  break;
  case 'A':
  //    strcat(return_string, "1010");
   num = "1010";
  break;
  case 'B':
  //    strcat(return_string, "1011");
   num = "1011";
  break;
  case 'C':
  //    strcat(return_string, "1100");
   num = "1100";
  break;
  case 'D':
  //    strcat(return_string, "1101");
   num = "1101";
  break;
  case 'E':
  //    strcat(return_string, "1110");
   num = "1110";
  break;
  case 'F':
  //  strcat(return_string, "1111");
   num = "1111";
  break;  
  default:
  printf("Program doesn't support this yet\n");   
  break;
  
  
  }
  
  printf("The binary equivalent of %s is %s\n", input_string, num);
  
  
  int z; 
  for (z = 0; return_string[z] != '\0'; z++) {
  
      if(return_string[z] = '5'){
          printf("%i",z);
          printf("Yo!\n");
          z++;
      }
  }
  return 0;
  
  
  
  }
  
  
  
  
  char *octal2dec(char s[]){
  
  
  
  
  }
  </code></pre>