title: How to convert from hexadecimal to binary using pointers in C
body: <p>I need to make a program that resolve operations between hexadecimal, where i ask for the number of hexadecimals to operate, ask for them, and then show the result.</p>
  
  <p>The operations that can be done are or,and,xor(|,^,&amp;). I made the convert part  with arrays where i storage the hex number, and then convert those in binary and save it in another array but when i realize i coudnt know how many integers of hex were going to operate i coudnt figure out how to create enough arrays to storage those someone told me about i had to use pointers. Im new to that and research a bit about that still dont know how pointers can work that out...</p>
  
  <p>Part of my code so far:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;math.h&gt;
  #include &lt;float.h&gt;
  #include &lt;proyecto.h&gt;
  #include &lt;string.h&gt;
  int main () {
    char op,bin1[31]="",bin2[31]="",hex1[100],hex2[100];
    int sizeh,repeat1,repeat2,n,z,i;
                printf("Write Hexadecimal:);
                scanf("%s",hex1);
                convert(hex1,bin1,n);
  </code></pre>
  
  <p>function convert:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;math.h&gt;
  #include &lt;float.h&gt;
  #include &lt;proyecto.h&gt;
  #include &lt;string.h&gt;
  void convert(char hex1[],char bin1[],int n){
  int i,b;
  printf("\nEquivalent binary value: ");
  for(i=0;i&lt;4;i++){
  switch(hex1[i]){
  case '0': strcat(bin,"0000"); break;
  case '1': strcat(bin,"0001"); break;
  case '2': strcat(bin,"0010"); break;
  case '3': strcat(bin,"0011"); break;
  case '4': strcat(bin,"0100"); break;
  case '5': strcat(bin,"0101"); break;
  case '6': strcat(bin,"0110"); break;
  case '7': strcat(bin,"0111"); break;
  case '8': strcat(bin,"1000"); break;
  case '9': strcat(bin,"1001"); break;
  case 'A': strcat(bin,"1010"); break;
  case 'B': strcat(bin,"1011"); break;
  case 'C': strcat(bin,"1100"); break;
  case 'D': strcat(bin,"1101"); break;
  case 'E': strcat(bin,"1110"); break;
  case 'F': strcat(bin,"1111"); break;
  case 'a': strcat(bin,"1010"); break;
  case 'b': strcat(bin,"1011"); break;
  case 'c': strcat(bin,"1100"); break;
  case 'd': strcat(bin,"1101"); break;
  case 'e': strcat(bin,"1110"); break;
  case 'f': strcat(bin,"1111"); break;
  default:  printf("\nInvalid hexadecimal digit %c ",hex[i]);
  }
  }
  printf("%s",bin);
  }
  </code></pre>