#whaat

24 messages · Page 1 of 1 (latest)

serene sleet
#

somebody tell me why the f does that ret print, print the same s&€& as the str print tff

umbral whaleBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

#

@serene sleet

Screenshots!

Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!

serene sleet
#

l is 2 or 1 so it should print something

#

yet it doesnt print anything

#

I'm not a complete noob i sort of know what i m doing but now I'm just super mad an astonished liie wtff

wispy bridge
wheat pond
#

ret[i] doesn't exist.

wispy bridge
#

It seems to work, but you are breaking rules that can result in horrible crashes

#

Try with a longer string and see for yourself

serene sleet
#

wdym it doesnt exist? do u mean i need to allocate for it? I thought u need not do it with cpp string class

north turtle
#

I mean as long as l is string's length nothing bad should happen right?

#

Im seminoob

#

plz explain 😄

wispy bridge
#

@serene sleet You're doing out of bounds access on ret

#

ret.size() is 0, you aren't allowed to touch any characters at index >= ret.size()

wheat pond
wispy bridge
#

It just happens to seem to work because of some implementation details for std::string

wheat pond
#

.push_back adds to the end and will allocate as necessary.

serene sleet
#

cpp is stupid

#

time to go back to C

#

SOLVED LOL