I normally program embedded devices in ASM and my boss asked me to fix some code that was written in C, I have done a little C but not to much.
The problem I've noticed is that a comparison doesn't always return true.
We have an array of characters UBconfigData.code2 and we have a constant
when these two get compared sometimes true is return and sometimes it is not.Code:#define VERSION "2.10" #define ScaleType "47 " #define ScaleVer ScaleType VERSION
UBconfigData.code2 is set by this methodCode:strcmp(UBconfigData.code2, ScaleVer )
I'm wondering does strcmp stop at the termination or does it continue to the end of the array?Code:strcpy(configData.code2,ScaleVer); //Update code1,2 to current version
Should I do a memcmp and memcpy?