Talk:Longest string challenge: Difference between revisions
Content added Content deleted
m (→bounds checking in C: comment) |
|||
Line 321: | Line 321: | ||
return 0; |
return 0; |
||
}</lang> I haven't carefully checked all the comparisons in the above, but it's on the right track at least. --[[User:Ledrug|Ledrug]] 00:17, 17 August 2011 (UTC) |
}</lang> I haven't carefully checked all the comparisons in the above, but it's on the right track at least. --[[User:Ledrug|Ledrug]] 00:17, 17 August 2011 (UTC) |
||
:::: Ok, I see what you are saying. I have updated the C implementation to avoid buffer overflow problems. Note that this will not prevent crashes nor erroneous results -- it's only correct if the lines are short enough and if few enough of them are long. --[[User:Rdm|Rdm]] 01:13, 17 August 2011 (UTC) |
|||
::In other words, this program will not block for input: <lang c>#include <stdio.h> |
::In other words, this program will not block for input: <lang c>#include <stdio.h> |
||
main() { |
main() { |