Recent pT-integrated cross-section measurements of the ground-state charm mesons and baryons, D0, D+, Ds+, Λc+, and Ξc0, are used to evaluate the charm fragmentation fractions and production cross section per unit of rapidity at midrapidity (|y|<0.5), in pp collisions at s=5.02 TeV at the LHC. The latter is dσcc¯/dy||y|<0.5=1165±44(stat)-101+134(syst) μb. These measurements were obtained for the first time in hadronic collisions at the LHC, including the charm baryon states, recently measured by ALICE at midrapidity. The charm fragmentation fractions differ significantly from the values measured in e+e- and ep collisions, providing evidence of the dependence of the parton-to-hadron fragmentation fractions on the collision system, indicating that the assumption of their universality is not supported by the measured cross sections. An increase of a factor of about 3.3 for the fragmentation fraction for the Λc+ with a significance of 5σ between the values obtained in pp collisions and those obtained in e+e- (ep) collisions is reported. The fragmentation fraction for the Ξc0 was obtained for the first time in any collision system. The measured fragmentation fractions were used to update the cc¯ cross sections per unit of rapidity at |y|<0.5 at s=2.76 and 7 TeV, which are about 40% higher than the previously published results. The data were compared with perturbative-QCD calculations and lie at the upper edge of the theoretical bands.