[Solved] Strlen returns undefined behaviour with C++ [duplicate]
Since you’re allocating a char array but do not initialize it, strlen() will count from the beginning of the tab pointer to the first NUL character. So the result depends on the contents of your program’s heap. 3 solved Strlen returns undefined behaviour with C++ [duplicate]