Ad
  • Custom User Avatar

    Strings are hard in C. This kata is not easy for beginner in this language. You could try to practice C-strings in some very basic katas to get more familiar with them.

  • Custom User Avatar

    There are several issues with what you are trying to do:

    • char declares a single character, so there is no way you can store a word (ie an array of characters null terminated in C) in it;
    • first_word[] is syntactically incorrect

    To create an array of strings you must allocate memory (using malloc or calloc) for a char** (an array of strings), and then allocate again memory for a char* (= a string) before copying each word you want in it (and still, this cannot be done as easily as in many other languages). I cannot explain everything in detail here, you should make a research with clever keywords (the commands I have mentionned, two dimensional arrays, etc.) on the C online documentation, you will find many resources.