How to build a string from analogRead values

Hello , i want to work with an analog keypad , im getting values with analogRead and my code understands which key is pressed so i can store it at int value = analogRead(1); . Thats ok , now lets say that value has the value 4 , and the next value will be 3 , i want to construct 43 ... i think its not possible with int type , so i have to use String or char , right ?

Thanks

You have to decide if you wanted is 43 (a numerical value), or "43", a string of chars.

dhenry:
You have to decide if you wanted is 43 (a numerical value), or "43", a string of chars.

numeric value is the best for me !

Think about how this might help:

    number = number * 10 + value;

-br

A decimal 43 is actually quite difficult to decode later. A hex 43 is far easier to decode and can be constructed easily:

value = (value << 4) | (analogRead(1) & 0x0f);

This will retain just the lowest four bits of analogRead().

billroy:
Think about how this might help:

    number = number * 10 + value;

-br

how simple and great...

dhenry thank you too !

invader7:

dhenry:
You have to decide if you wanted is 43 (a numerical value), or "43", a string of chars.

numeric value is the best for me !

In that case "How to build a string from analogRead values" is a highly misleading title.