Message from C, C++ talks

July 2019

— Just closes

— He set 0, but probably lose real length of allocated memory, which \0 was indicated by

— Idk, think lots of errors

— 🤣🤣


Can anyone recomment me some practising exercises to understand those errors and to practise more things like this?

— If he removes spaces from string in the same string it's natural allocated space in the end will be lost.

Message permanent page

— But it doen't matter - free will free it.
We don't even use heap memory, so what's wrong?

— And there is a case, when full string is a space_only, than first element will be '\0'

— That may be interpeted like ptr == NULL

— So, potentially, memory leak :3

— What's wrong with empty string with first element \0?

— Sorry, my fault)

— We don't change pointers, how can it become NULL?

— I understand already

— 👍