nope, it's not correct, I wonder whether your code even compiles, in case it compiles, you are allocating memory by "new char[]" and then, instead of assigning it to messagePtr and setting its contents to "System Check", the address of "System Check" assigned to messagePtr (it's a char array after all), causing a memory leak.
Later when deleting messagePtr (delete [] messagePtr) you are actually trying to delete "System Check" memory, and since it's not valid heap memory, your getting an error.
The correct way to do it is:
Code:
#define MAX_MESSAGE_SIZE 1024
char* messagePtr;
messagePtr = new char[MAX_MESSAGE_SIZE];
strcpy(messagePtr, "System Check");
// later
delete [] messagePtr;
Anyways, instead of using char* and heap memory, why don't you simply std::string?
Code:
#include <string>
using namespace std;
string message;
message = "System Check";
// no need to delete anything, std::string takes care of such stuff for you