In most cases, yes. But you'll want to double-check before flying out that sleeping in the airport terminal is allowed. Some airports do close overnight, which means you'll need to look for another option to get some rest. Many larger airports have hotels near them or even attached to them.