Measurement of charm production at central rapidity in proton-proton collisions at √s = 7 TeV