The atomic number of hydrogen is 1 so it has 1 electron in its outer shell.
The atomic number of carbon is 6 so it has 4 electrons in its outer shell.
Carbon can shaer 1 electron with each of 4 different hydrogen atoms,which has the effect of allowing all atoms to have a complete outer shell.