The iPhone pass code is a security feature that secures your information by asking for a four-digit or custom pass code to unlock the device.
If you happen to forget the pass code and need access to your iPhone,
you must restore the software to its original settings,
followed by restoring your device`s information to a date prior to creating a pass code.
Plug the docking cable into your iPhone and into the computer`s USB drive.
Right-click "iPhone" in the iTunes side window,
and click "Restore."
Click "Don`t Back Up." Wait for the iPhone`s software to be reinstalled,
and click "Restore from backup."
Select an earlier backup date in the iPhone setup window,
and click "Continue."
That's one way. Another way is to plug your iPhone into your computer, power it down, and then hold the "power" and "home" buttons until the phone puts itself into Recovery Mode. Now you can install a clean iOS on top of the password-protected one. This is because while it's in Recovery Mode, iTunes won't register that it's a password-protected phone.