I don't think you have done your homework on this question. In all everyday chemistry pure carbon burns in one of two simple reactions. We could represent the first as:
2C + O2 --> 2CO
That shows two carbon atoms combining with one molecule of oxygen to give two molecules of carbon monoxide. This is the main reaction we get when there is not a lot of extra oxygen available. If there is plenty of oxygen then we expect most of the burning to take the form of a second reaction:
C + O2 --> CO2
There we get a single carbon having a whole oxygen molecule to itself, reacting to give a molecule of carbon dioxide.
Commonly that second reaction happens in two steps:
2C + 2O2 --> 2CO + O2 --> 2CO2
First one reaction produces carbon monoxide that then reacts with more oxygen, producing the carbon dioxide. That is what we sometimes see when a charcoal fire glows where the carbon reacts with the air, producing carbon monoxide, which then drifts over the coals, reacting with more oxygen in eerie blue flames that produce carbon dioxide.
Hydrogen has nothing to do with either of those reactions as shown. If any hydrogen is present, then it will react independently with the oxygen, giving water. That is all. If we are burning a hydrocarbon, such as naphthalene, in plenty of oxygen, then we get something like:
C10H8 + 12O2 --> 10CO2 + 4H2O
The water is not so much a by-product as just a product -- it just happens to be the stuff you get when you burn hydrogen in oxygen...
The term "by-product" does not have much meaning in chemistry as such, though it might be of interest to a chemical engineer.
As for burning carbon in the presence of oxygen... would you not prefer to rephrase that? No one mentioned burning the carbon in something else, say chlorine; then how would you burn carbon in the absence of oxygen, or at the least an oxidising agent? As the reactions that I mentioned show, the product is CO2 or CO -- By-products don't come into the matter. Whether you burn the carbon, whether diamond or graphite or methane, in a bomb, a stove or a campfire, the carbon gets oxidised to an oxide. What part of that deal puzzles you?