[Solved] K&R, find longest line, same code but not working?
Okay, here’s the error: s[i++] = ‘\0’; // always put a ‘\0’ character to a string array ending, so that the compiler knows it’s a string. This will cause it to terminate the string even for no input (when it got EOF directly), and since it increments i before returning it, getLine() will never return … Read more