Concatenate integers as string How can i concatenate integers as a single string?

int out1, out2, out3 = 0;

    out1 = digitalRead(r1);
    out2 = digitalRead(r2);
    out3 = digitalRead(r3);


I tried like so, between others, with no luck.

Serial.write(out1 + "" + out2 + "" + out3);


For example the expected result when all outputs are HIGH should be 111, while when only the r3 output is HIGH it should be 001 

All i want, is reporting to the sender of the serial command, the pins state
If you're just outputting to serial you don't need to concatenate - just print each bit separately, such as:

Serial.print(out1);
Serial.print(",");
Serial.print(out2);
Serial.print(",");
Serial.println(out3);


You should avoid using String as it's not good on devices with small amounts of memory like Arduinos. Instead if you really need to concatenate numbers you should use a C string and maybe snprintf to format the numbers into it:

char out[30];
snprintf(out, 30, "%d,%d,%d", out1, out2, out3);