System is said to have achieved noble-gas configuration, when it's valance shell is completely filled.
Atomic number of carbon is 6. Thus, it has 6 electrons.
The electronic configuration of carbon is 1s2 2s2 2p2
Now, the inert gas closest to C is Ne, whose atomic number is 10.
Thus, there are excess of 4 electrons in Ne as compared to C.
Hence, carbon must gain 4 electrons to achieve noble-gas configuration.
Alternatively, C can also lose 4 electron to achieve noble gas configuration of He.