if else condition not working properly

 char ch[]={'1','2','3','4'};
//values sent through bluetooth and stored in c variable (c is the input given from android) and then it checks d if else condition which is below 

 if(c[0]==ch[0] && c[1]==ch[1] && c[2]==ch[2] && c[3]==ch[3]){   // variable c is taken from bluetooth and ch variable values are already saved and stored     
           Serial.println("CORRECT PASSWORD");
           delay(5000);
      }
      else{
           Serial.println("WRONG PASSWORD....");
           delay(2000);
           flag+=1;
     }

when i print values of c and ch , the values corresponding to d same index are same but still when i give it as a condition it is not working

Are you maybe comparing ASCII to numbers like byte or int.

Without seeing your complete code, we have to believe you; add the following lines before the if for testing purposes

memset(c, 0, sizeof(c));
memset(ch, 0, sizeof(ch));

That guarantees the c an ch contain the same data (all zeroes).

LarryD:
Are you maybe comparing ASCII to numbers like byte or int.

i used serial print to check what it prints and it printed d value wich i sent that is 1234

prostriker:
i used serial print to check what it prints and it printed d value wich i sent that is 1234

I don't see any variable called d. What type is d?

Te

prostriker:
i used serial print to check what it prints and it printed d value wich i sent that is 1234

Tell a computer to print ascii 31, it will look exactly the same as numerical value 1, but it isn't. Try abcd as password to prevent mixup.

We need the sketch.

.

Delta_G:
I don't see any variable called d. What type is d?

Probably means 'de' which is dutch for 'the'.

LarryD:
We need the sketch.

I already told OP that, but not as clearly as you did ;).

Gabriel_swe:
Te
Tell a computer to print ascii 31, it will look exactly the same as numerical value 1, but it isn't. Try abcd as password to prevent mixup.

ASCII 31 (Unit Separator) is normally invisible. ASCII 49 (0x31) on the other hand, looks a lot like a one digit.

Surely you should have both the password entered and the one stored as
strings, then use strcmp() ? After all they are strings, conceptually...