The flower on top of the fruit has withered away. I used to pull one of these fruit off the cactus and eat the black seeds out of them when I walked through the desert when I was a kid. Each one of these fruit are packed full of little black seeds.
I believe this barrel is the genus ferocactus type of cactus. We have a lot of barrel cacti in Arizona as we are part of the Sonoran Desert.
Ferocactus means fierce and they survive everywhere. Sometimes barrel cactus fall over and people mistakenly think it is from water weight. Not true. Barrel cactus follow the sun and are often called "Compass Cactus."