Since water and carbon dioxide are both compounds which contain oxygen, it is possible to obtain oxygen from either, but you get a different residue depending upon which compound is the source of the oxygen. Take the oxygen out of water and you are left with hydrogen gas; take the oxygen out of carbon dioxide and you are left with carbon, which is a black solid. It is easy to spot the difference between hydrogen and carbon.