password requirements (changing required amounts of digits)

Hello, I have just started with Arduino and am looking to make an edit to some code a friend wrote.

In some parts the code, user has the option to enter a password, right now they are forced to enter an 8 digit number. I would like to reduce this to a 4 digit number.

I figured I would ask for advice here , before making that change and causing myself issues down the line.

Do I simply change the [8] to [4] and the for(int i=0;i<8;i++){ to for(int i=0;i<4;i++){

Thanks in advance.
In the code I have this :

//This fuction compare codeInput[8] and password[8] variables
boolean comparePassword(){

 for(int i=0;i<8;i++){
   if(codeInput[i]!=password[i])return false;
 }
 return true;
}

//Set the password variable
void setCode(){

 lcd.setCursor(0, 1);
 for(int i=0;i<8;i++){
   while(1){
     var= getNumber();
     if(var !='x'){
       codeInput[i] = var;

       if (i != 0){
         lcd.setCursor(i-1,1);
         lcd.print("*");
         lcd.print(var);
       }
       else
       {
         lcd.print(var);
       }
       tone(tonepin,2400,30);
       break;
     }
   }
 }
}

In the code I have this

Does your code REALLY look like that? I seriously doubt it.

If you can't read the stickies at the top of the forum, and follow the rules, why should we try to help you?

That was helpful Paul, Thank you .

I apologize that I may not be a pro l, I am trying to learn this on my own. Everyone learns one time or the other. Instead of being discouraging , try being helpful .

maybe that was the wrong code I posted.

maybe this is correct code. I honestly do not know, that is why I am asking here. To try to learn.

char codeInput[8];
byte time[4];
boolean refresh=true;//1 refresh one time...
char password[8];
int key=-1;
char lastKey;
char var;
boolean passwordEnable=false;

maybe this is correct code

It is the same code, now posted properly, so we can make sense of it.

At least, it's SOME of your code...

It appears, though, that all you need to do is the change the 2 8s that you asked about to 4s.

It would be better, though, to

#define PASSWORD_LENGTH 8

and use PASSWORD_LENGTH in place of the 28s you asked about. Then, it would be very obvious what to change to change the password length.