Skip to content

Instantly share code, notes, and snippets.

@murikadan
Created August 26, 2012 11:15
Show Gist options
  • Save murikadan/3477649 to your computer and use it in GitHub Desktop.
Save murikadan/3477649 to your computer and use it in GitHub Desktop.
Function generating unique substrings of an input string
void stringgen(char *c)
{
int i=0,j=0,l;
l=strlen(c);
while(l>=1)
{
for(i=0;i<l;++i)
{
char *buf=malloc(sizeof(char)*(i+2));
for(j=0;j<=i;j++)
buf[j]=*(c+j);
buf[j]='\0';
printf("%s\n",buf)
}
--l;
++c;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment