The momentum distribution of electrons from decays of heavy flavor (charm and bottom) for midrapidity absolute value of y < 0.35 in p + p collisions at square root of s = 200 GeV has been measured by the PHENIX experiment at the BNL Relativistic Heavy Ion Collider over the transverse momentum range 0.3 < pT < 9 GeV/c. Two independent methods have been used to determine the heavy-flavor yields, and the results are in good agreement with each other. A fixed-order-plus-next-to-leading-log perturbative QCD calculation agrees with the data within the theoretical and experimental uncertainties, with the data/theory ratio of 1.71+/-0.02stat+/-0.18sys for 0.3 < pT < 9 GeV/c. The total charm production cross section at this energy has also been deduced to be sigma cc = 567+/-57stat+/-193sys microb.