Skip to main content
4 events
when toggle format what by license comment
Oct 12, 2017 at 3:43 comment added Peter Nguyen haha I guess it's filed under #mysteriesofC for now.
Oct 10, 2017 at 15:42 comment added Blauelf It all depends on the byte behind *C. If that one's 0 by coincidence, strcmp would see a one-character string, and everything's fine. If there's something other than zero, strcmp would assume that to be part of the string (strings range up to the next zero byte), and a string "\nArbitraryData" is considered larger than "\n". Not sure why this differs in the two cases. Not sure why this code works in the first place either :P
Oct 6, 2017 at 8:36 comment added Cliff B Maybe @kareem can explain WHY this code works on its own but fails when run with valgrind. I had the same experience running your code.
Oct 6, 2017 at 6:33 history answered Peter Nguyen CC BY-SA 3.0