Aims. The composition of planetary solids and gases is largely rooted in the processing of volatile elements in protoplanetary disks. To shed light on the key processes, we carry out a comparative analysis of the gas-phase carbon abundance in two systems with a similar age and disk mass, but different central stars: HD 100546 and TW Hya. Methods. We combine our recent detections of C 0 in these disks with observations of other carbon reservoirs (CO, C + , C 2 H) and gas-mass and warm-gas tracers (HD, O 0 ), as well as spatially resolved ALMA observations and the spectral energy distribution. The disks are modelled with the DALI 2D physical-chemical code. Stellar abundances for HD 100546 are derived from archival spectra. Results. Upper limits on HD emission from HD 100546 place an upper limit on the total disk mass of ≤0.1 M . The gas-phase carbon abundance in the atmosphere of this warm Herbig disk is, at most, moderately depleted compared to the interstellar medium, with [C]/[H] gas = (0.1−1.5) × 10 −4 . HD 100546 itself is a λ Boötis star, with solar abundances of C and O but a strong depletion of rockforming elements. In the gas of the T Tauri disk TW Hya, both C and O are strongly underabundant, with [C]/[H] gas = (0.2−5.0)×10 −6 and C/O > 1. We discuss evidence that the gas-phase C and O abundances are high in the warm inner regions of both disks. Our analytical model, including vertical mixing and a grain size distribution, reproduces the observed [C]/[H] gas in the outer disk of TW Hya and allows to make predictions for other systems.