To prevent sewer gasses and odors from entering the house,
drains are protected by traps. A trap is a curved section of drain pipe that fills up with water, providing a seal. Drains that penetrate a wall have a P trap and those that go through the floor have an S trap. The water held by the trap is replaced each time the fixture is used.
--Don Vandervort