diff --git a/generate.c b/generate.c index cdbdd70..3a14d6d 100644 --- a/generate.c +++ b/generate.c @@ -21,9 +21,11 @@ static char* alphabetize(weylgroup_element_t *e, char *str) { if(e->wordlength == 0) sprintf(str, "1"); - else + else { for(int j = 0; j < e->wordlength; j++) - sprintf(str, "%c", e->word[j] + 'a'); + str[j] = e->word[j] + 'a'; + str[e->wordlength] = 0; + } return str; }