请教一个简单问题
#include <stdio.h>
#include <stdlib.h>
void swap(char* a, char* b);
void perm(char* l, int i, int n);
void perm( char* l, int i, int n)
{
int j;
if(i == n-1) {
for(j = 0; j < n; j++){
printf("%c", l[j]);
printf("");
}
}
else{
for(j = i; i < n; j++){
swap(&l[j], &l[i]);
perm(l, j+1, n);
swap(&l[j], &l[i]);
}
}
}
void swap(char* a, char* b)
{
char temp;
temp = *a;
*a = *b;
*b = temp;
}
void main()
{
char list[5] = {'A', 'B', 'C', 'D', 'E'};
perm(list, 0, 5);
system("pause");
}
请教高手我这段程序总是出错编译不过去问题在哪呢?谢谢