Changeable password lock system

When I compile there is no error, logically it should work. Because the char code[] there, I have put it 6 digits. And the sizeof(code) is depends on how much digits that I had insert. It's true?