3 ms·
Yeah, but I think the question was why EOF and "\n". It could as easily just return 1 or -1 for example, and it would make more sense I think.
by m45t3r 5y ago
Yeah, but I think the question was why EOF and "\n". It could as easily just return 1 or -1 for example, and it would make more sense I think.
- kevin_thibedeau 5y agoputs() always adds a line termination so success means that '\n' is the last char for that implementation.
- masklinn 5y agoThat's more of an implementation detail, probably a BC remnant from when it called putchar in a loop and you’d get the result if the last putchar.