We investigate the formation of CIII 4647-51-50 and CIII 5696 in the atmosphere of O stars to see if they can be reliably used for abundance determinations. We use atmosphere models computed with the code CMFGEN. The key physical ingredients explaining the formation of the CIII lines are extracted from comparisons of models with different stellar parameters and through examining rates controlling the level populations. The strength of CIII 5696 critically depends on UV CIII lines at 386, 574 and 884 A. These lines control the CIII 5696 upper and lower level population. CIII 884 plays a key role in late O stars where it drains the lower level of CIII 5696. CIII 386 and CIII 574 are more important at early spectral types. The overlap of these UV lines with FeIV 386.262, FeIV 574.232 and SV 884.531 influences the radiative transfer at 386, 574 and 884 A, and consequently affects the strength of CIII 5696. CIII 4650 is mainly controlled by the CIII 538 line which acts as a drain on its lower level. FeIV 538.057 interacts with CIII 538 and has an impact on the CIII 4650 profile. Low temperature dielectronic recombinations have a negligible effect on the line profiles. Given our current understanding of the stellar and wind properties of O stars, and in view of the present results, the determination of accurate carbon abundances from CIII 4647-51-50 and CIII 5696 is an extremely challenging task. Uncertainties lower than a factor of two on C/H determinations based only on these two sets of lines should be regarder as highly doubtful. Our results provide a possible explanation of the variability of CIII 4650 in Of?p stars.