int to hex

I am trying to convert an int between 0-255 to a 2 character hex code and put it in to a string variable. I could not find a function other than print(variable, HEX); is there anotherway to do this as printing does not help setting another variable.

I could not find a function other than print(variable, HEX); is there anotherway to do this as printing does not help setting another variable.

sprintf() can do it.

char nibbleToHex (char nibble)
{
  char n = nibble & 15;
  return (n > 9) ? n - 10 + 'A' : n + '0';
}

I am trying sprintf("%X",sensor_serial_int*); and i get back an error* 108: error: invalid conversion from 'int' to 'const char*' 108: error: initializing argument 2 of 'int sprintf(char*, const char*, ...)'

I am trying sprintf("%X",sensor_serial_int); and i get back an error

Well, of course you do. The first argument is the array to write to. The second argument is the format string. The 3rd and additional arguments are the variables that hold the data to be formatted.

You forgot something...