C++ – how to add a int to a char[] in c/c++

cchar

i have a code like this:

int i = 123;
char myString[100];
strcpy(myString, "my text");

and how i want to add the 123 after "my text". how to do this in c/c++?

at the end myString sould be my test123

Best Answer

In C++:

std::stringstream ss;
ss << "my text" << i;
std::string resultingString = ss.str();

There's no such thing as C/C++.