What is wrong with this line of code?

I keep getting an error message on this line of code? if ((char*)data == 'l'){} Saying "Reciever:37: error: ISO C++ forbids comparison between pointer and integer"

void loop(){
  byte data[Mirf.payload];
  
  if(!Mirf.isSending() && Mirf.dataReady()){
     
    Mirf.getData(data);
   
   Serial.println((char*)data);
    if ((char*)data == 't'){}
  }
}

The error message is pretty explicit. Try data[0] == 't'

Thank your, it worked!

AWOL knows his stuff, so I don't think anyone is surprised that it worked. But do you know why his answer worked?

I'm guessing it had to do with the byte data[Mirf.payload]; statement above? I do not really know why though.

I'm guessing it had to do with the byte data[Mirf.payload]; statement above?

No. It is because data is an array. An array of characters can never equal the single character 't'. By changing the comparison to the first element of the array, there is a possibility that the first letter in the array will be 't'.

Oh yes, that makes sense thank you for the clarification. So is it then possible to say

if (data == 'text'){
// do stuff }

No, for two reasons. 'text' will compile but doesn't do what you think, and data == "text" won't work unless "data" is a String.

if (strcmp (data, "text") == 0) will do what you want, if "data" is a correctly terminated C-style string.