it's really oxygen and hydrogen that count. the separation of those two from water is photosynthesis and the recombination is respiration.
The function of carbon or carbon dioxide is as a carrier molicule for the hydrogen (there is no free gas in any of the various biological reactions). CO2 plus H is a carbohydrate.
You have to tell more. I will fail in science.