I have the following code within my program -
char code; char codesent; //code below is located in main loop Serial.println(code); strncpy (codesent,code); //Take of copy of the code used for the transaction
I am have a code value in the variable "code" and sometimes I want to take a copy of it into "codesent" so I know what code has been sent out to the PC as the code value will constantly change. Using the following line "strncpy(codesent,code)" gives some very strange results. I would have thought that it should copy code into codesent.
Can anyone confirm if the above should work?