33,311
社区成员
发帖
与我相关
我的任务
分享
const char* sz1= “one”;
const char* sz2= “two”;
const char* sz3= “three”;
void my(int i,char**pp)
{
int nlen=0;
switch(i)
{
case 1:
nlen=strlen(sz1);
*pp=malloc(nlen+1);
strcpy_s(*pp,nlen+1,sz1);
break;
case 2:
nlen=strlen(sz2);
*pp=malloc(nlen+1);
strcpy_s(*pp,nlen+1,sz2);
break;
case 3:
nlen=strlen(sz3);
*pp=malloc(nlen+1);
strcpy_s(*pp,nlen+1,sz3);
break;
}
}