The structure of carbon isotopes from the proton-drip-line nucleus C-9 to the neutron-drip-line nucleus C-22 has been systematically studied in the framework of the nonlinear relativistic mean-field theory with inclusion of deformations, Calculations show that the relativistic mean-field theory provides a reasonably good description of experimental binding energies and root-mean-square radii. The spin and parity of the ground stale in C-15,C-17,C-19 are correctly predicted to be (1/2)(+), (3/2)(+) and (1/2)(+), respectively. The effect of deformations on the structure of exotic nuclei is discussed and a consistent explanation on the one-neutron halo in C-19 is given.