Implement substringList() that will produce the collection of words from the 1D array B that has substrings equivalent to the string key. The resulting collection should be stored in array C and this should contain only the unique set of words. The function returns the resulting total number of elements in array C. For your reference, a substring is a contiguous sequence of characters within a string. As an example, the strings “app”, “ppl”, “apple”, and “e” are among the substrings from the string “apple”. But, strings “ale” are “elppa” are not substrings from string “apple”. key = "or" array B = {"it's", "today", "now", "or", "forever", "today", "ACT"} array C should be {"or", "forever"} Rules: You can only use strcmp, strcat, and strcpy Maximize the use of loops (e.g., for) you can create local variables that can aid
Implement substringList() that will produce the collection of words from the 1D array B that has substrings equivalent to the string key. The resulting collection should be stored in array C and this should contain only the unique set of words. The function returns the resulting total number of elements in array C. For your reference, a substring is a contiguous sequence of characters within a string. As an example, the strings “app”, “ppl”, “apple”, and “e” are among the substrings from the string “apple”. But, strings “ale” are “elppa” are not substrings from string “apple”.
key = "or"
array B = {"it's", "today", "now", "or", "forever", "today", "ACT"}
array C should be {"or", "forever"}
Rules: You can only use strcmp, strcat, and strcpy
Maximize the use of loops (e.g., for)
you can create local variables that can aid you
Step by step
Solved in 2 steps with 1 images