Carbon overcomes above problem and forms a large number of compounds by sharing its valence electrons with other atoms of carbon or with atoms of other elements, thereby satisfying requirement to attain noble configuration of all the combining atoms.
For example, carbon forms methane as shown below:
In methane, carbon shares its four valence electrons with four valence electrons, one each from four hydrogen atoms.
Thus carbon attains the configuration 2, 8 as that of nearest noble gas, neon.
And all four hydrogen atoms individually attain the configuration of helium gas, Bond so formed due to sharing of electrons is called covalent bond.