I have a sentence stored in char text[100] . I have to rearrange the words like this : one word per line and the words that have at least n letters have priority.
I thought about storing the words into 2d char arrays depending on how many letters the word has, but I can't figure how to add and keep the words into the array. I tried with strcpy() but in the end all I'm left with is the last valid word.
1 2
char big[100][25] //for words >= n letters
char small[100][n] //for words <=n-1 letters
Sorry about that. I figured it though.
Here is an example: n=4.
"My grandma is very old" should print
grandma
very
My
is
old
The problem was at lines 37 and 40. It should have been <big_word and <small_word because the first word in the array occupied position 0 in the 2d array yet big_word and small_word started from 1.