C语言里怎么把两个字符串合并或替换?

2025-01-08 12:15:47
推荐回答(1个)
回答1:

        #include 
        #include 
        int main(int argc, char *argv[])
        {
           char name[][20]= {"Lily","Xiaoming","Scott","Max"};
            char name2[]= "James";
            int i;
            strcpy(name[3],name2);
            for (i=0;i<4;i++)
            printf("%s\n",name[i]);
            return 0;
            }