C3 plants use the Calvin cycle to fix carbon. C4 plants use a modified Calvin cycle in which they separate Ribulose-1,5-bisphosphate carboxylase oxygenase (RuBisCO) from atmospheric oxygen, fixing carbon in their mesophyll cells and using oxaloacetate and malate to ferry the fixed carbon to RuBisCO and the rest of the Calvin cycle enzymes isolated in the bundle-sheath cells. The intermediate compounds both contain four carbon atoms, which gives C4. In Crassulacean acid metabolism (CAM), time isolates functioning RuBisCO (and the other Calvin cycle enzymes) from high oxygen concentrations produced by photosynthesis, in that O is evolved during the day, and allowed to dissipate then, while at night atmospheric CO is taken up and stored as malic or other acids. During the day, CAM plants close stomata and use stored acids as carbon sources for sugar, etc. production.
The C3 pathway requires 18 ATP and 12 NADPH for the synthesis of one molecule of glucose (3 ATP + 2 NADPH per  fixed) while the C4 pathway requires 30 ATP and 12 NADPH (C3 + 12 ATP per  fixed). In addition, we can take into account that each NADPH is equivalent to 3 ATP, that means both pathways require 36 additional (equivalent of) ATP [better citation needed]. Despite this reduced ATP efficiency, C4 is an evolutionary advancement, adapted to areas of high levels of light, where the reduced ATP efficiency is more than offset by the use of increased light. The ability to thrive despite restricted water availability maximizes the ability to use available light. The simpler C3 cycle which operates in most plants is adapted to wetter darker environments, such as many northern latitudes. Maize, sugar cane, and sorghum are C4 plants. These plants are economically important in part because of their relatively high photosynthetic efficiencies compared to many other crops. Pineapple is a CAM plant.