Concatenate Char* and uint64_t

Hello all,

I have been reading all night about this, and it seems that i can't reach to any conclusion, maybe i am misunderstanding the explanations that i found or maybe this is actually pretty much complicated than what it looks, so, here it goes:

I am doing this simple piece of code to debug:

char* a = "ABC";
uint8_t x = 123;
uint64_t y = 123;

void setup() {

char b[10] = "ABC";
strcat(b,char(y));
Serial.begin(9600);
Serial.println(b);
}

Is there any way i can have the array of characters b or a with the value ABC123 (So results of concatenation of the array and one of the integers declared above)?

Thank you vbery much in advance.

  char b = "ABC";

A char variable can only hold a single character

Hi,

Sorry, b is an array, formating of the message got it switched up, declaration is char b [ 10 ].

That is because you did not use code tags, which also messed up your quotation marks

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code

char(y) looks wrong too

Your best option is to use sprintf() to concatenate the variables and strings and make them a single string

Not easy on most arduinos, the 64-bit integer type is generally not supported by most functions.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.