message = strcat("TEXT " , var);
message2 = strcat(strcat("TEXT ", foo), strcat(" TEXT ", bar));
I'm trying to put a string after a fixed string It keeps saying Segmentation Fault.
How do I paste a const/literal string?
string c concatenation
message = strcat("TEXT " , var);
Is the intention to do ("TEXT" + var) and save the address in the message?
char * strcat (char * destination, const charge * source);
and destination
must be char array buffer
.
But a string like "TEXT" cannot be expressed properly in Korean.It's a kind of constant because it's ), so you can't put another string after it.
To code with this intention
char myTEXT[] = "TEXT ";
message = strcat(myTEXT, var);
In the same way, "TEXT" should be stored in a separate writable memory space.
© 2024 OneMinuteCode. All rights reserved.