That's the general idea, but it presumes a couple of things, like the person armed with the gun has it holstered or at least not in hand and already aimed at the knife wielder.
I've always heard 20-21 feet as the danger close distance, and when you take a "permit to carry" training course, you have to qualify on the firing range at 21 feet.
But, there are several other factors involved, most notably the competency of the 2 combatants, physical fitness (a 350 lb guy with asthma probably won't close the distance fast enough <grin>), terrain and topography (obstacles, and who has the high ground).
A knife in trained hands does have the added advantage of being both a ranged and close combat weapon, although the range of a thrown knife is far shorter than any gun, the 16-21 feet range is well within it's capacity. and in very close quarters, the gun severely limits the defensive and offensive options of the holder, it only works in one direction, a knife can injure or kill from multiple angles.
See 8 other replies