Is possible to concatenate integers? It's a basic one: I have two values from two different analogRead pins:

int val1;
int val2;


For example, val1 = 10 and val2 = 10. How could I put these two values into a variable val3 = val1 + val2 that will give the answer 1010, instead 20 ?
If you are reading from the analog pins then the values are 10 bits (not 8 as suggested above).  Are you looking at concatenating 2 10 bit numbers or 2 16 bit numbers or are you using a zero or duo in which case they could be 12 bit numbers.

In any case:

const int BITMASK = 0x3FF;  // 10 bits = 0x3FF, 12 = 0xFFF, 16 = 0xFFFF
const int BITWIDTH = 10;
long result = ((value1 &amp; BITMASK) &lt;&lt; BITWIDTH) | (value2 &amp; BITMASK);


I suspect it won't give you the answer you want, but...