Carbon must share 4 electrons total with the the two Oxygen atoms in order to fill it's outer electron shell, and each Oxygen atom must share 2 electrons with the Carbon atom to fill their electron shells. Therefore, in total 8 electrons must be shared (4+2+2=8)