When I run the .exe being created with the below code in debug mode , it shows some assertion failure and the programme crashes But when i run the same exe created from the rele
You're trying to deallocate the character-string literal "Hello". This line:
"Hello"
buf = "Hello";
redirects the pointer buf to point at the literal "Hello". You probably meant to do this:
buf
char *buf = new char[6]; //need one extra space for terminating NUL character strcpy(buf, "Hello");