【原创】连接字符串数组

#include<stdio.h>

#include
<stdlib.h>



charUnionStringArray(charStringArr[],intiArrCount,charstrTarget);



intmain(intargc,char
argv[])

{

charbillFields[11]={"product_id","product_class_id","product_name","product_unit","product_num","product_pym",

"product_provider","purchase_date","remark","rec_status","operator"};



charselect_fields[1000]="";



UnionStringArray(billFields,
11,select_fields);

printf(
"%s\r\n",select_fields);



system(
"PAUSE");

return0;

}



char
UnionStringArray(charStringArr[],intiArrCount,charstrTarget)

{

inti;

for(i=0;i<iArrCount;i++)

{

if(i<iArrCount-1)

{

strcat(strTarget,
"t1.");

strcat(strTarget,StringArr[i]);

strcat(strTarget,
",");

}

else

{

strcat(strTarget,
"t1.");

strcat(strTarget,StringArr[i]);

}

}



returnstrTarget;

}

该程序的测试环境:

WinXPSP2,Dev C++ 4.9.9.2

原文链接: https://www.cnblogs.com/feima-lxl/archive/2010/08/05/1793223.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/13440

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月7日 下午12:50
下一篇 2023年2月7日 下午12:51

相关推荐