I am writing simple function for merging two C-strings. While trying to dynamically alocate new chunk of memory i found out that :
char * out = new char[size];
std::cout << strlen(out) <<std::endl;
Returns 16 when size is 4 and 40 when size is 22 and so on. Does anyone have an idea why it acts like that and how to allocate memory for c-string with certain number of chars?