Storing array

Hello everyone,

I have a confusion and a problem to solve regarding the code.
The function display on the code is used for my keyless security door to chang its password when # is pressed on the keypad.

As you can see in the code when I used the code for PART 1, the lcd will ask for the old password for verification and if the password is correct it will ask for the new password which is 4 character.

If we comment on all of PART 1 and uncomment PART 2, I am expecting it to do the same as in PART 1. But the problem is when in PART 2, at the part where it ask for the new password, instead of storing 4 character, my code only store 1 character.

Please help me solve and guide me on this problem and please provide the example if possible.

void change()
{
  int j=0;
  lcd.clear();
  lcd.print("UR Current Passk");
  lcd.setCursor(0,1);
  while(j<4)
  {
    char key=kpd.getKey();
    if(key)
    {
      pass1[j++]=key;
      lcd.print(key);
      
    }
    key=0;
  }
  delay(200);
  
  if((strncmp(pass1, pass, 4)))
  {
    lcd.clear();
    lcd.print("Wrong Passkey...");
    lcd.setCursor(0,1);
    lcd.print("Better Luck Again");
    delay(1000);
  }
  else
  {
    j=0;
    
  lcd.clear();
  lcd.print("New Decimal:");
  lcd.setCursor(0,1);
  while(j<4)
  {
    char key=kpd.getKey();
    if(key)
    {
      lcd.print(key);
//*******PART 1************************LOOPING ARRAY****************************************************************
      pass[j]=key;
      EEPROM.write(j,key);
      Serial.print(EEPROM.read(j));
      j++;
//*******PART 2*************************************************************************************************
/*
      if(j=0)
      {
        pass[j]=key;
        EEPROM.write(j,key);
        Serial.println(EEPROM.read(j));
        j++;
      }
      if(j=1)
      {
        pass[j]=key;
        EEPROM.write(j,key);
        Serial.println(EEPROM.read(j));
        j++;
      }
      if(j=2)
      {
        pass[j]=key;
        EEPROM.write(j,key);
        Serial.println(EEPROM.read(j));
        j++;
      }
      if(j=3)
      {
        pass[j]=key;
        EEPROM.write(j,key);
        Serial.println(EEPROM.read(j));
        j++;
      }   
      */
  //****END OF PART 2*****************************************************************************************************
    }  
  }


  lcd.print("  Done......");
  delay(1000);
  }
  lcd.clear();
  lcd.print("Enter Ur Passk:");
  lcd.setCursor(0,1);
  key=0;
}
      if(j=0)

Assigning a value to a variable in an if statement IS possible, but it is unlikely that that is what you want to do.

= != ==