Turning program into reusable function in C help???
https://code.sololearn.com/cR0VbZRJ37G7 I would like to change the following into a reusable function that accepts a string and returns a multidimensional array of word strings. Any help is greatly appreciated. Specifically what does the function declaration look like and then a main below it that gets the string as input and prints the words maybe??? #include <stdio.h> #include <string.h> int main(){ char input[200], word[20][20]; int inputLength, i, j = 0, wc = 0; fgets(input, 200, stdin); inputLength = strlen(input); for (i = 0; i <= inputLength; i++){ if (input[i] == ' ' || input[i] == '\0') { word[wc][j] = '\0'; j = 0; wc++; } else { word[wc][j] = input[i]; j++; } } printf("Original sentence: %s\n", input); for(i = 0; i < wc; i++){ printf("Word %d: %s\n", i + 1, word[i]); } return 0; }