Because char *Command[50];
is not the same as char* TX_String
. char* TX_String
is a pointer to a sequence of characters, while char *Command[50];
is an array of such pointers.
Try this:
void prepareAndSend() {
char Command[50];
sprintf(Command,"%s", "65535V");
unsigned char checksum = 0x02;
char* p = Command;
while(*p) {
checksum ^= *p++;
}
checksum ^= 0x03;
std:cout << checksum << std::endl;
}