Please tell whats the error… why it’s not compiling?

Use this

printf("%s" , word);

instead of

printf("%s" , *word); 

Because the *word will be the value at word[0] which is a character. The printf however is looking for an array of chars, thus causing it to segfault. strings are just arrays of characters terminating with '\0'.

Leave a Comment