Strcmp not working with multiple conditions combined with logical OR statement ( || )

Hello. I would like some guidance regarding multiple strcmp statements. I have found a simmilar post but the issue not been solved:

I have a variable item_inside.state. I want to compare whether it is set to "PILDYMAS" or "DISABLED" and if it is not either 2 of those, I want to read the sensor, else dont read the sensor.

I can easily do this with the following code;

 if( strncmp(item_inside.state, "DISABLED", 8)  !=0 ) 
  {
    Read_sensor_no_delay(tft_object);
  }

 if( strncmp(item_inside.state, "PILDYMAS", 8)  !=0 ) 
  {
    Read_sensor_no_delay(tft_object);
  }

However, it would be much more clean if I could do :

  if( (strncmp(item_inside.state, "PILDYMAS", 8)  !=0)  ||  (strncmp(item_inside.state, "DISABLED", 8)  !=0) )  
  {
    Read_sensor_no_delay(tft_object);
  }

Unfortunately, the above code just does not work. Even though I have set my state to "PILDYMAS" or '"DISABLED" it still performs read_sensor_no_delay function.

Has anyone else faced this issue? Can this be fixed?

The logical expression state ≠ "A" or state ≠ "B" can never evaluate to false, because state cannot be equal to "A" and "B" simultaneously.

(By the way, if this is some kind of state machine, use an enum, not C-strings.)

Hey. Thanks for the response. I cannot fully get my head around on what you said. Now I do not know anymore whether I understand IF statement correctly. For example if my state is "IDLE" and I compare it with both "PILDYMAS" and "DISABLED", then the comparison !=0 will be TRUE because "IDLE" is not equal to "PILDYMAS" or "DISABLED". However, if I set my state to "DISABLED" and then do comparison, since one of the condition in if statement is met , it should return false. The same with the following:

The following will return true because one of the contition is met

x = 5
if (x==5) || or (x==6)

The following will return false

x=4
if (x==5) || or (x==6)

Why is this not the same in my case?

if fruit is not pear or fruit is not banana then eat fruit.

Try the above sentence with "apple" and "pear" for the fruit.
It is the combination of != with ||

The strncmp() returns zero when they are equal: https://www.cplusplus.com/reference/cstring/strncmp/

Ahhh now it totally makes sense... Thank you very much!