Currently trying to fix code that was left unused for a while.
I have two variables: int8_t foo[size]
and const char* const bar
.
There is an if that checks if(0 != strcmp((char *)foo, bar))
Currently this is failing even though printf("%s | %s", foo, bar)
returns two strings the exact same. I also tried strncmp
which is also failing.
From researching online, I understand this is most likely due to terminating null bytes however I don't grasp how I would resolve/get around that.
int8_t foo[size];
const char* const bar;
if(0 != strcmp((char *)foo, bar)){
fail
}
Expect results are strcmp
returning 0 because both strings are the same when printing.
Actual outcome: returning fail.
Actual data: 5352A565712345657567565785658956581
When running printf("Value of foo and bar: %s and %s", foo, bar)
, both variables return that data above.