Carbon dioxide molecule is made up of one atom of carbon and two atoms of oxygen. Carbon has four electron in its valence shell while oxygen has 6 electrons in its valence shell. Thus carbon needs four electron to attain the octet structure and each oxygen atom needs two electrons to attain the octet structure; for the two oxygen atoms, four electrons are needed.
The type of bond formed in carbon dioxide is called COVALENT BOND. The two oxygen atom donate two electrons each and these are linked together with the four electrons on the outermost shell of the carbon atom. Thus, at the end of the bonding, each of the atoms will have 8 electrons in its outermost shell.