The desired result can be output to the specified string, but also as a buffer, but only printf output to the command line: Function srpintf () function is very powerful.
Header files: stdio.h
Function: format string, writing data formatted string.
int sprintf(char *buffer, const char *format, [argument]…)
Parameters: (1) buffer: char type is a pointer, a pointer to a string written; (2) format: format string, i.e., the desired format in the program; (3) argument: an optional parameter can be any type of data;
#include<stdio.h> int main() { char buffer[10]; char *a = "1234"; char *b = "5678"; sprintf(buffer, "%s%s", a, b); printf("%s\n", buffer); return 0; }