The true answer above is "both" can be highly effective, and should be given equal respect.Yes, knives can be very dangerous in close quarters, but a decent powered gun with effective ammunition in the hands of someone who knows how to use it is highly effective.
I think many, and obviously some gun owners here, dont give the knife the respect it deserves. I know this is a gun forum, and the gun tends to be the answer to every problem, but thats not reality either.
If you really think about it, a penetrating wound, be it a knife stab, or a bullet, are really not all that different, and both require good hits on key targets to bring about a result. Just simply shooting or stabbing away is in no way, a guarantee of stopping an opponent. Timing with a similar "hit" with either, is going to be about the same as well.
In some respects, the knife has an advantage, as it can be easier to hit those extremity targets that many give no thought to, but are just as deadly as being shot there, but even easier to cut. Those same targets will take away your gun advantage, and the ability to use that hand beyond that as well. It also starts the clock on your soon to be "short" life, if you fail to act and do something to stop the blood loss. All that on top of a continuing attack that you have to continue to deal with.
A knife can be used in multiple ways, doesnt jam, doesnt run out of bullets, and creates even more fear than a gun in many cases, especially if the victim understands what they are really facing, and isnt in denial, or overly confidant, or reliant on their favorite tool/talisman.