Greetings There is such a code fragment:
#define _CRT_SECURE_NO_WARNINGS #include <Windows.h> #include <tchar.h> #include <cstdlib> #define SIZEBUF 4 #define SIZEQUEST 30 #define RAD 10 int main() { int nCountAtt = 0; wchar_t* pQuest = new wchar_t[SIZEQUEST]; wchar_t* pBuff = new wchar_t[SIZEBUF]; _itow(nCountAtt, pBuff, RAD); pQuest = L"Вы загадали число "; wcscat(pBuff, L"?"); wcscat(pQuest, pBuff); //здесь возникает ошибка delete[] pBuff; delete[] pQuest; return 0; } In the marked line of code, the exception described in the header occurs. I understand that going beyond the allocated memory is happening, but I cannot understand why this is happening. Tell me the reason, please.