

If you see the kast shell electronic configuration, in 2s2 it has 2 electrons and in 2p2 it has another 2 electrons. Therefore, the valency is the no. of electrons an atom ca gain, lose or share so that it achieves the stable octet for its outermost shell. Here, in case of carbon it is 8-4 = 4 electrons.
