title: Store HEX char array in byte array with out changing to ASCII or any thing else
body: <p>My <code>char</code> array is <code>"00000f01"</code> and I want it to be like <code>byte out[4]={0x00,0x00,0x0f,0x01};</code> I tried the code sent by @ChrisA and thanks to him the <code>Serial.println( b,HEX );</code> shows exactly what I need but 1st I can not access this output array because when I try to print "out" array it seems empty I also tried this code:</p>
  
  <pre><code>void setup() {
      Serial.begin(9600);
      char arr[] = "00000f01";
      byte out[4];
      byte arer[4];
      auto getNum = [](char c){ return c ; };
      byte *ptr = out;
      for(char *idx = arr ; *idx ; ++idx, ++ptr ){
          *ptr = (getNum( *idx++ ) &lt;&lt; 4) + getNum( *idx );
      }
      int co=0;
      //Check converted byte values.
      for( byte b : out ){
          Serial.println( co );
          Serial.println( b,HEX ); 
          arer[co]=b;
          co++; 
      }
      //    Serial.print(getNum,HEX); 
      //    Serial.print(out[4],HEX); 
      //    Serial.print(arer[4],HEX); 
      /*
      none of this codes commented above worked*/
  }
  
  void loop() {
  }   
  </code></pre>
  
  <p>but it is not working neither. please help me.</p>