Code A #!/usr/bin/perl use strict; my @string = qw(a a b h a g s j s z u u e); my @a = Suff(@string); print "@a\n"; #so here i should get numbers form 0..18 or something use Inline C => <<'END_OF_C_CODE'; #include #include #include #include void Suff(SV* array, ...){ int i,n; Inline_Stack_Vars; n = Inline_Stack_Items; char **sarray; sarray = (char **)malloc(n * sizeof(char *)); char *string[Inline_Stack_Items]; for (i = 0; i < n; i++){ string[i] = SvPV(Inline_Stack_Item(i), PL_na); printf("%s",string[i]); // it prints characters instead of strings } for(i=0;i## Code B - this is what i'm aiming to get as a final result, it depends on what can i return to perl from c but the list of suffixes should be printed in the end int test(){ char **sarray; int i, n=15; sarray = (char **)malloc(n* sizeof(char *)); char *string = "lhfsadgfbfsdaubsdkj"; for(i=0;i## lhfsadgfbfsdaubsdkj - hfsadgfbfsdaubsdkj - fsadgfbfsdaubsdkj - sadgfbfsdaubsdkj - adgfbfsdaubsdkj - dgfbfsdaubsdkj - gfbfsdaubsdkj - fbfsdaubsdkj - bfsdaubsdkj - fsdaubsdkj - sdaubsdkj - daubsdkj - aubsdkj - ubsdkj - bsdkj - sdkj - dkj - kj - j #### my @string = qw(a a b h a g s j s z u u e); #### aabhagsjszuue - abhagsjszuue - bhagsjszuue - hagsjszuue - agsjszuue - gsjszuue - sjszuue - jszuue - szuue - zuue - uue - ue - e - #### use strict; my @string = qw(a a b h a g s j s z u u e); my $n=@string; my $str = join('',@string); my @a = Suff($str,$n); foreach (@a){ print "@string[$_..$n]\n"; } use Inline C => <<'END_C'; #include #include #include #include void Suff(char* array,int n){ int i; char **sarray; sarray = (char **)malloc(n * sizeof(char *)); char *string; string = savepv(array); for(i=0;i