79639475

Date: 2025-05-26 19:24:45
Score: 0.5
Natty:
Report link

There are two things wrong with your code:

  1. Most importantly, in your innermost loop, the while loop, you are setting k to 0 and then saving the current letter into index k of word, that is, in index 0. So you are always overwriting the same array element. With the letters e, v, o and l in order. So the final value is l.
  2. When printing the result you are using the length of the array, so 25 regardless of the length of the word you have found. Since an char array is initialized to hold \0 chracters, 24 of these are printed before the l.
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Tapuarii Horvat