#include <stdio.h> #include <string.h> int main(int argc, char **argv) { char city[50] = "chengdu"; char name[30] = "guanxianseng"; char cityAndName[90]; strncpy(cityAndName, city, 50); strncat(cityAndName, "_", 1); strncat(cityAndName, name,30); printf("cityAndName:%s ", cityAndName); return 0; }