There are several methods to concatenate strings into C, you can use the sprinf, or the strcat.
The sprintf, works the same as printf, the difference is the string parameter that you will insert the value of.
You can concatenate numbers and floating points using the sscanf.
strcat:
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv){
char str1[50];
char str2[50];
char cat[100];
strcpy(str1,"texto da string1"); // insere o texto em str
strcpy(str2," | nova parte do texto");
bzero(cat, 100); // limpa a variavel cat
strcat(cat, str1); // concatena valores em cat
strcat(cat, str2);
puts(cat);
}
sprintf:
#include <stdio.h>
int main(int argc, char **argv){
char str1[50];
char str2[50];
char cat[100];
sprintf(str1,"Primeira parte");
sprintf(str2,"Segunda parte");
sprintf(cat,"%s - %s",str1, str2);
puts(cat);
}
A simple way to concatenate Char into C++ https://youtu.be/ZkYhmHD7XRo
– mrsoliver