填空题

[说明]
函数perm(int n,char *s)用已知字符串s中的字符,生成由其中n个字符组成的所有字符排列。设n小于字符串s的字符个数,其中s中的字符在每个排列中最多出现一次。例如,对于s[]=“abc”,n=2,则所有字符排列有:ba,ca,ab,cb,ac,bc。
[函数]
#define N 20
char w[N];
perm(int n,char *s)

char s1 [N];
int i;
if( (1) )
printf("%s\n",w);
else

strcpy(s1,s);
for (i=0; (2) ; i++)

(3) ;
(4) ;
*s1=* (w+n-1);
(5) ;



【参考答案】

perm(n-1,s1+1)
热门 试题

填空题
v->next=p
填空题
p->next=top
相关试题