I have the following C++ code:
#define VERSION 1
#define TYPE "this"
...
bool update(const char* json) {
...
const char* theType = doc["type"]; // "this"
int theVer = doc["version"]; // 2
//int ourVer = VERSION;
//char ourType[] = TYPE;
if ( (theVer > VERSION) && (theType == TYPE) ) {
return true
} else {
return false;
}
}
I can print both theType
and theVer
, but I am not able to successfully compare them with the constants. I also tried to compare to the casted constants (commented out) to no avail.
How do I compare strings and integers defined by #define?
BTW. This is coded in ArduinoIDE.