If hetro atom with lone pair is neighboring to carbocation, then that lone pair can be donated to empty orbital on carbocation (see figure below). These orbitals are said to be in conjugation. Conjugation leads to delocalization of electrons resulting in resonance structures.
Quoting from "Organic Chemistry" by T.W. GRAHAM SOLOMONS , CRAIG B. FRYHLE .SCOTT A.SNYDER12edition:
Structures in which all the atoms have a complete valence shell of electrons (i.e., the noble gas structure) are more stable.
The third structure (your structure C) does not have conjugation. Hence it is comparatively less stable then 1st and 2nd structures.
Among 1st and 2nd structures , due to lower electronegativity of Nitrogen compared to Oxygen , Nitrogen has greater electron pair donating tendency. Therefor the order of stability is as follows.