I have a program to compile,need help.
/*This program is to permute some letters of alphabet.
However i can not compile it .
There are always many errors.
your help will be appreciated deeply.
I am a new guy in Ubuntu .*/
Code:
#include<stdio.h>
#include<string.h>
int L;
void insort(int n,char s[],char c[]);
void insort(int n,char s[],char c[])
{
char d[50];
char str1[50],*str2;
int i;
if(n==0) s[n]=c[n];
else{ for(i=n;i>=0;i--)
{ memcpy(d,s,strlen(s));
d[strlen(s)]='\0';
memcpy(str1,d,i);
str1[i]='\0';
str2=d+i;
strcat(str1,c[n]);
strcat(str1,str2);
//d=str1;
memcpy(d,str1,strlen(str1));
d[strlen(str1)]='\0';
if (n==L)printf("%s\n",d);
}
}
if (n+1<=L)
insort(n+1,s,c);
}
int main(){ char str[1000];
str[0]='\0';
char S[]="abcd";
L =strlen(S);
insort(0,str,S);
return 0;
}