Can not print an element in an specific position in an arduino list I have been tying to print an element of a list with the same position as the number that it matches, but it does not seem to work and I can not figure out if I made some mistake, could someone please check it? Would really appreciate it

Here are the list declarations:

int names[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; 
char *users[10] = {"Josh", "John", "Frederic", "Mikael", "Anthony", "Charles", "Tom", "Chris", "Steve", "Mike" };


And this is what I am using to print the name I need:

if (attempt != FINGERPRINT_OK) return -1; 
Serial.println ("Belongs to: "); 
if(data.fingerID == names[n]) {
    Serial.print(users[n]); 
}


Complete Code:

#include &lt;Adafruit_Fingerprint.h&gt;
#include &lt;SoftwareSerial.h&gt;

SoftwareSerial mySerial(2, 3);
pinMode (12, OUTPUT);
pinMode (13, OUTPUT);

Adafruit_Fingerprint data = Adafruit_Fingerprint(&amp;mySerial); 

int names[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; 
char *users[10] = {"Josh", "John", "Frederic", "Mikael", "Anthony", 
"Charles", "Tom", "Chris", "Steve", "Mike" };

void setup() {
  Serial.begin(9600);
  while (!Serial);
  data.begin(57600);
  if (data.verifyPassword()) { 
    Serial.println("Verified connection");
}

  else {
    Serial.println("Unnable to verify connection, try again");
 while (1) { delay(2500); }
}

data.getTemplateCount();
Serial.print("Waiting for one of the:"); Serial.print(data.templateCount);
Serial.println("valid fingerprint");


int getFingerprintIDez();
uint8_t getFingerprintID();

void loop() { 
for ( int i = 0; i &lt;= 10; i++) {
 uint8_t attempt = data.getImage();
  switch (attempt) {
   case FINGERPRINT_OK:
   break;
 delay (2500);
}

attempt = data.image2Tz();
  switch (attempt) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
    break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
    return attempt; 
  }

 attempt = data.fingerFastSearch(); 
   if (attempt == FINGERPRINT_OK) { 
    Serial.println("Found a print match!");
    digitalWrite (13, HIGH);
    delay(1250 );
    digitalWrite (13, LOW);
  } 
   else if (attempt == FINGERPRINT_NOTFOUND) { 
   Serial.println("Did not find a match"); 
   digitalWrite (12, HIGH);
   delay(1250 );
   digitalWrite (12, LOW);
   return attempt; 
  }
Serial.print("Found ID #"); Serial.print(data.fingerID); 
Serial.print(" with confidence of "); Serial.println(data.confidence); 
return data.fingerID; 

uint8_t attempt2 = data.getImage();
if (attempt2 != FINGERPRINT_OK) return -1; 
 attempt2 = data.image2Tz(); 
if (attempt2 != FINGERPRINT_OK) return -1; 
 attempt2 = data.fingerFastSearch(); 
if (attempt2 != FINGERPRINT_OK) return -1; 
 Serial.println ("Presents: "); 
if(data.fingerID == names[n]) {
    Serial.print(users[n]); 
}
}
}


I am attempting that when a fingerprint is verified, the position that matches it out of all the stored fingerprints gets stored as n so I can later print the name asigned to that same position. Thanks
How about you completely delete

int names[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; 


and instead do:

if (attempt != FINGERPRINT_OK)
    return -1;

Serial.println ("Belongs to: "); 
Serial.print(users[data.fingerID - 1]);