  The production of heavy quarks in pp collisions at the LHC energies provides
a reliable test of perturbative QCD calculations. Comparisons of pp and $\pPb$
measurements of their hadronization products allow us to investigate how cold
nuclear matter effects affect the heavy-quark production. We present ALICE
measurements of azimuthal correlations of prompt D mesons with charged hadrons
in pp collisions at $\s$ = 7 TeV and $\pPb$ collisions at $\sNN$ = 5.02 TeV. We
also show the per-event D-meson yields as a function of the charged-particle
multiplicity in pp collisions at $\s$ = 7 TeV.
