This is because carbon has four valence electrons (electrons in its outermost shell) and needs to gain or share four more to achieve a stable octet configuration.