The is a difference between deflagration (what guns do) and detonation. Gunpowder Deflagrates.
Deflagration is basically a fast burn of combustible material. A black powder pipe-bomb deflagrates.
Detonation is a supersonic shock via chemical reaction. C4 explodes via shock caused by a detonator.