Read from a array and compare

I am trying to read a RFID tag and compare the RFID Number with a array which have already there. In my code, the comparing is not working properly. It always gives output as both ‘Found’ and ‘Not found’ . Can any one help me on this. The two RFID numbers that I want to read are: 37376B34 and 7AA29B1A. These two are only for the testing. I’m going to store about 20 RFID numbers in the array and check.

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance.

    int readsuccess;
    byte readcard[4];
    char str[32] = "";
    String StrUID;
    char* myTags[] = {"9FF4375C","37376B34","7AA29B1A","1B7D5223","9FF4375C" };
    
    void setup() {
      Serial.begin(9600); // Initialize serial communications with the PC
      SPI.begin();      // Init SPI bus
      mfrc522.PCD_Init(); // Init MFRC522 card
    }
    // --------------------------------------------------------------------
    void loop() {
      readsuccess = getid();
     
      if(readsuccess){
        Serial.println(StrUID);
        delay(1000);
      }
    
    for (int i = 0; i < 5; i++) {
                if (StrUID == myTags[i]) {
                  Serial.println("Found");
                  return;
                }
                else{
                  Serial.println("Not Found");
                  
                }
    
              }
          
      
    }
    // --------------------------------------------------------------------
    int getid(){  
      if(!mfrc522.PICC_IsNewCardPresent()){
        return 0;
      }
      if(!mfrc522.PICC_ReadCardSerial()){
        return 0;
      }
      for(int i=0;i<4;i++){
        readcard[i]=mfrc522.uid.uidByte[i]; //storing the UID of the tag in readcard
        array_to_string(readcard, 4, str);
        StrUID = str;
      }
      mfrc522.PICC_HaltA();
      return 1;
    }
    // --------------------------------------------------------------------
    void array_to_string(byte array[], unsigned int len, char buffer[])
    {
        for (unsigned int i = 0; i < len; i++)
        {
            byte nib1 = (array[i] >> 4) & 0x0F;
            byte nib2 = (array[i] >> 0) & 0x0F;
            buffer[i*2+0] = nib1  < 0xA ? '0' + nib1  : 'A' + nib1  - 0xA;
            buffer[i*2+1] = nib2  < 0xA ? '0' + nib2  : 'A' + nib2  - 0xA;
        }
        buffer[len*2] = '\0';
    }

have you tried printing the value in "str" and since you're using char arrays, why not do a strcmp()?

consider

#include <stdio.h>
#include <stdint.h>
#include <string.h>

typedef uint8_t  byte;

// -----------------------------------------------------------------------------
const char* myTags[] = {
    "9FF4375C","37376B34","7AA29B1A","1B7D5223","9FF4375C"
};
#define N_TAG  (sizeof(myTags)/sizeof(char*))

#define N_BYTE  4
uint8_t myInp [][N_BYTE] = {
    { 0x9F, 0xF4, 0x37, 0x5C },
    { 0x37, 0x37, 0x6B, 0x34 },
    { 0x7A, 0xA2, 0x9B, 0x1A },
    { 0x1B, 0x7D, 0x52, 0x23 },
    { 0x9F, 0xF4, 0x37, 0x5C }
};
#define N_INP  (sizeof(myInp) / N_BYTE)

// --------------------------------------------------------------------
const char *
findTag (
    char *s )
{
    for (unsigned n = 0; n < N_TAG; n++)  {
        const char *p = myTags [n];
        if (! strcmp (p, s))
            return p;
    }

    return NULL;
}

// --------------------------------------------------------------------
void array_to_string(
    byte            array[],
    unsigned int    len,
    char            buffer[] )
{
    for (unsigned int i = 0; i < len; i++)
    {
        byte nib1 = (array[i] >> 4) & 0x0F;
        byte nib2 = (array[i] >> 0) & 0x0F;
        buffer[i*2+0] = nib1  < 0xA ? '0' + nib1  : 'A' + nib1  - 0xA;
        buffer[i*2+1] = nib2  < 0xA ? '0' + nib2  : 'A' + nib2  - 0xA;
    }

    buffer[len*2] = '\0';
}

// -----------------------------------------------------------------------------
int
main ()
{
    char s [80];

    for (unsigned n = 0; n < N_INP; n++)  {
        uint8_t *p = myInp [n];

        for (unsigned i = 0; i < N_BYTE; i++)
            printf (" %02x", p [i]);

        array_to_string (p, N_BYTE, s); 

        printf ("   %s", s);
        printf (" %s", findTag (s));

        sprintf (s, "%02X%02X%02X%02X", p[0], p[1], p[2], p[3]);
        printf ("   %s", s);
        printf (" %s", findTag (s));

        printf ("\n"); 
    }
}

output

 9f f4 37 5c   9FF4375C 9FF4375C   9FF4375C 9FF4375C
 37 37 6b 34   37376B34 37376B34   37376B34 37376B34
 7a a2 9b 1a   7AA29B1A 7AA29B1A   7AA29B1A 7AA29B1A
 1b 7d 52 23   1B7D5223 1B7D5223   1B7D5223 1B7D5223
 9f f4 37 5c   9FF4375C 9FF4375C   9FF4375C 9FF4375C