So I have a function that will put a received value into a char array, and then afterwards I need to check if the data in a char array is equal to a value such as 00, 01, 02 etc.
I originally tried to do this like this:
if (val == "01") {
//do thing
}
This spits out an error, and I found the easiest way to fix this was by using the atoi function to convert the char array to and int. This is my code
if (atoi(val) == 01) {
//do thing
}
This works, but I feel like it's not the proper way of doing this. Are there any issues associated with doing this? Is there a better option?