A gun while camping is all but useless unless it's in a position where you can fire it within seconds. If you see the wildlife and it hasn't already charged you, then you generally have time to back away. If you see a big brown bear and it's charging toward you (40mph?) then the best you're probably going to do with that gun is leave a blood trail for the conservation officers to follow as they search for the man killer. Then again if it's late summer/early fall, with all the fat, wounded bears are often very difficult to track - the fat clogs the wound & they stop leaving a blood trail.
As far as black bears, if there's an issue, it's the fault of humans. Both types of bears generally avoid humans when they can - they don't actively stalk humans. (Good thing!) Usually a little noise scares them off. Then again, if you're too noisy, you don't get the opportunity to experience that wildlife close up. I've been within feet of black bears a couple of times; both times are permanently etched in my mind. One was because I stalked a deer that was making a rub on a tree - it was a bear itching its back; ooops! The second time, some other noisy people (dirt bikes) scared a momma bear and her cub. They ran straight up the trail I was walking down. I was just barely off the trail, leaning against a tree. I could almost have reached out and touched the momma bear.
--
Another tip - not for backpack camping; but for family style camping: if you have a deep fryer at home, when you change the oil, save the old oil. I have almost 2 gallons to take on our trip this summer. It's like using kerosene to start a fire. If your fire is barely going, the wood is a little damp/green, and you want a roaring fire & then hot coals to cook some food over, splash some oil on the fire. It's a lot safer than charcoal lighter, and doesn't have the smell of petroleum products (diesel, kerosene, or if you're a nutcase, gasoline.)
Therefore, the ideal thing to bring camping with you is an extra "friend" who can't run as fast as you can. And, you don't have to carry them.