Carbon is  a tetravalent molecule. ie it has 4 electrons in the outer shell.
Its oxidation states are +4 and -4. By losing 4 electrons or by gaining 4 electrons , it will attain stable configuration Hence it can either lose or gain electrons during the formation of ionic bond. But carbon usually undergoes covalent bonding where electrons are shared. 
1 5 1
it does not lose electrons nd gain electronss
it can do either of them

Normally a single atom of carbon doesn't gain or loose electrons because it has 4 electrons in its outermost shell. A single carbon atom doesn't have the required energy to gain or lose 4 electrons together to fulfill its octet configuration. However  sometimes carbon does share its electrons with another during bonding so as to fulfill its octet configuration.
1 5 1
btw carbon doesn't lose or gain electron as stated earlier