Can anyone help me, why I\'m getting an error message while trying to free the allocated memory: Heap corruption detected. CTR detected the application wrote the memory after en
From man strcpy(3):
The strcpy() function copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dest.
So you need to reserve 6 bytes 5 for the string and 1 for the NULL byte
6
5
1
NULL
char *s = new char [6]; strcpy(s, "hello");