so in this code you are using an int, but you should be using char

I dont get why you dont just do a -= 48; or a -= 55;

a*16 should be a << 4

you don’t accommodate for ‘a’ or ‘f’ (lowercase)

Not only that, but the input should be a string, not 2 integers.

something like this, not tested…(got to go to work, ran out of time)

```
int hexToDec(char* hex){
int output = 0;
signed char sign = 1;
byte start = 1;
if(hex[0] == '0' && (hex[1] == 'x' || hex[1] == 'X'))
start = 3;
if((hex[start - 1] >= '8' && hex[start - 1] <= '9') || (hex[start - 1] >= 'a' && hex[start - 1] <= 'f') || (hex[start - 1] >= 'A' && hex[start - 1] <= 'F'))
sign = -1;
for(byte i = start; hex[i] != '\n'; i++, output <<= 4){
if(hex[i] >= '0' && hex[i] <= '9')
output += '9' - hex[i];
else if(hex[i] >= 'a' && hex[i] <= 'f')
output += 'f' - hex[i];
else if(hex[i] >= 'A' && hex[i] <= 'F')
output += 'F' - hex[i];
}
return output * sign;
}
```