[...] and I didn’t know about itoa.
1. itoa(arg1, arg2, arg3); ------> itoa(int, buffer, base);
2. itoa stands for "integer to ASCII."
3. itoa() is a function which transforms the arg1 (an int value) into digits as many as required as demanded by arg3 (base: 10 or 16 or ...); each digit is replaced by its ASCII code; the resultant ASCII code (s) is saved in an character type array referred/pointed by arg2.
arg1 (argument1) : int x = 0x10A;
arg3 : 10
Created digits are : 2, 6, 6 //because 0x10A (hexadecimal value) = 266
arg2 : char myArray;
Serial.print(myArray); //Serial Monitor will show: 266
int x = 0x10A; // x could be any unknown value like x = analogRead(A3);
char myArray; //should have some idea about the size of the input/output data
itoa(x, myArray, 10);
Serial.println(myArray); //shows: 266
itoa(x, myArray, 16);
Serial.println(myArray); //shows: 10a (10A)