comparing input to char array

Hi! I’m trying to compare the input from serial to a char array but I can’t make it work.

char incoming_char[14];
char number[]="+639151234567";

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  if (Serial.available()>0)
  {
    for ( int i=0; i<=12; i++)
    {
      incoming_char[i]=Serial.read();
      incoming_char[i+1]='\0';
    }
    Serial.println();
    Serial.print("number: ");
    Serial.println(incoming_char);
    
    if (incoming_char==number)
    {
      Serial.println("allowed");
    }
    else
    {
      Serial.println("not allowed");
    }
  }
}

this is what i get from the serial monitor:

number: +ÿÿÿÿÿÿÿÿÿÿÿÿ
not allowed

number: 639151234567

not allowed

number: 
ÿÿÿÿÿÿÿÿÿÿÿÿ
not allowed

You have made the classic mistake with Serial.available:

  if (Serial.available()>0)
  {
    for ( int i=0; i<=12; i++)

You have assumed that because there is something delivered by the serial port, that there are 12 characters there. That is not the case, you need to check every time before you try to read a character.

'number' is a pointer, 'incoming_char' is a pointer. They are unlikely to be equal. Either use memcmp, or strcmp.

Another simple way of doing somewhat the same thing.

// zoomkat 8-6-10 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

String readString;


void setup() {
    Serial.begin(9600);
        pinMode(13, OUTPUT);
        Serial.println("serial test 0021"); // so I can keep track of what is loaded
        }

void loop() {

        while (Serial.available()) {
        delay(2);  
      char c = Serial.read();
        readString += c; 
        }
        
      if (readString.length() >0) {
      Serial.println(readString);
     
    if (readString == "on") {
    digitalWrite(13, HIGH);
        Serial.println("Led On");
    }
   if (readString == "off") {
    digitalWrite(13, LOW);
        Serial.println("Led Off");
    }
        readString="";
   } 
}