Dear all.
i would like to know is it possible to concanate the integer value as complete string
i have 4 parameter
a=1;
b=2;
c=3;
d=4;
String s1=(char*)(a+b+c+d);
if yes how can we do it
expected output: "1234"
Dear all.
i would like to know is it possible to concanate the integer value as complete string
i have 4 parameter
a=1;
b=2;
c=3;
d=4;
String s1=(char*)(a+b+c+d);
if yes how can we do it
expected output: "1234"
sir,
i had done like below,
int a = 1;
int b = 2;
char str1[5];
char str2[5];
void setup()
{
Serial.begin(9600);
sprintf(str1, "%d", a);
sprintf(str2, "%d", b);
strcat(str1, str2);
Serial.println(str1);
}
void loop()
{
//
}
char str[5]; // make it big enough for your longest string, including the null terminator
int a=1;
int b=2;
int c=3;
int d=4;
snprintf(str, sizeof(str), "%d%d%d%d", a, b, c, d);
// str now contains "1234"