The atomic no. of carbon is 6 having configuration 2,4 i.e 2 electrons in K and 4 electrons in valence L shell.There are two reasons why it forms only covalent bonds which are as follows-
1.Like other elements in order to aquire the noble gas configuration it can either lose or gain is 4 valence elctrons.But loss or gain of 4 electrons by the carbon atom to form highly charged C4+or C4-ions would require a very large amount of energy which is not ordinarily available during a chemical reaction.So it does not form ionic bonds and participate only in the formation of covalent bonds.
2.Another reason can be justified on the basis of its electronegativity value which is 2.5.Since it lies in group IV of the periodic table this value is neither very low nor very high.The other atoms with which generally it is linked in organic compounds like H,O,etc.the electronegativity difference is not very much and thus it forms bonds which are predominantly covalent.