Ad
  • 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.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution