Both char*, the topic is a message I receive over MQTT and the Topics[] array contains some predefined messages to compare to the sent topic, if there is a match I get the index where the topic is saved in Topics.
septillion:
So, how do you confirm what? With that snippet I see noting that would verify that statement.
Try making a MCVE. Only then we can help. But we probably don't even need to. Because in >50% of the cases you notice the error while doing so
This is the barebones code, the problem is that without the println the strcmp isn't working, and I can't view the output of the strcmp because as soon as I do, it starts to give the correct output (anyone got Schrodinger's digits?). I have half a mind to just leave the println in at this point, been up for a while trying to figure this one out lol.
hashttl:
Both char*, the topic is a message I receive over MQTT and the Topics[] array contains some predefined messages to compare to the sent topic, if there is a match I get the index where the topic is saved in Topics.
char* is not nesscesary/guaranteed a string. Perhaps it's time you post complete code.
No, that is a barebones snippet. Post ALL of your code.
What is likely happening is that the Serial.print() statement is writing to a full buffer, so it has to wait for room to be made, and, during the time it is waiting, more serial data arrives, and you actually have something valid to compare.