Almost right :P I could get all scientific but basically a plant uses, carbon dioxide, water and light to produce sugars for storing energy using photosynthesis. The oxygen a plant produces is actually from excess oxygen in the water used, not the carbon dioxide :)
Having said that, Minecraft...