8

I was failing all the test cases for a CS assignment where we had to implement our own methods for strings in C++. After an hour of debugging, turns out strings don’t end with ‘/0’ in C++ like in C.
Fuck my life.

Comments
  • 4
    They don't end with '/0' in even C. '\0'
  • 0
    @CodesNotHot Oh yeah, I didn’t realize cuz I was using my phone’s keyboard lol.
  • 0
    Welcome to mutable strings
  • 0
    Don't they?

    I would think a character array would need to... Especially if allocated on the heap?
  • 0
    @AlgoRythm Well at that time I was new to C++, and I didn’t know that C++ had a “string” class where strings are objects. They terminate with 0 rather than ‘\0’.
Add Comment