Everyone knows that the primary offensive weapon of an aircraft carrier or a big-deck amphibious assault ship is the aircraft on board. But those planes gotta drop (or fire) something at targets on the ground. Those planes also need stuff to fire at enemy planes (or missiles), as they are also the primary defensive weapon of those ships.
But all that stuff that goes boom needs to be kept somewhere safe. Why? Because if that stuff goes off at the wrong time, the best case can be a very messy situation, like that on the aircraft carrier USS Forrestal (CV 59) off Vietnam.
It can get worse than the fire on the Forrestal. When the escort carrier USS Liscome Bay (CVE 56) was hit off Makin Island in 1943, ordnance blew up, sinking the ship in 23 minutes and killing 644 of her crew. Three of the Japanese carriers that were sunk at Midway, the Akagi, Kaga, and Soryu, all went down due to bombs for their planes going off after they were hit.
The United States learned from World War II. Today, the bomb magazines are kept deep inside carriers and amphibious assault ships. They carry a lot of bombs, missiles, and rockets. These weapons are prepared in the magazines, and then shipped up on special elevators to the flight deck where they can be loaded onto the planes.
People often describe carriers (as well as the amphibious assault ships) as an airport on top of a floating city. That's not quite the truth. The carriers and amphibious assault ships are airports on top of floating forward operating bases – and they are mobile.
You can see some of the operations of the magazine on board the Wasp-class amphibious assault ship USS Essex (LHD 2) in the video below.