I would have to agree with your first statement. A gun is a great deterrent, without a doubt.
But the rest I disagree with, because a gun wasn't originally designed with deterrent in mind (though is certainly used by many for such a purpose).
And sure, from a technical aspect a gun is designed to shoot a projectile, but you are twisting the logic here - it was designed that way explicitly to kill things (people, originally).
My point being that, unlike a knife that was designed to cut rope or food, or a hammer that was designed to hammer nails, shooting a projectile actually serves, by itself, no practical purpose. I mean guns weren't invented or produced to machine-gun a tree down, or to demolish walls - they were and are designed to kill. That is practically their only purpose. Hell, even C4 has a practical purpose other than killing.