The structure of cadmium was characterized in both the solid and liquid forms at pressures to 10 GPa using in situ x-ray diffraction measurements in a resistively heated diamond anvil cell. The distorted hexagonal structure of solid cadmium persists at high pressures and temperatures, with anomalously large c/a ratio of Cd becoming larger as the melting curve is approached. The measured structure factor S(Q) for the melt reveals that the cadmium atoms are spaced about 0.6 Angstroms apart. The melt structure remains notably constant with increasing pressure, with the first peak in the structure factor remaining mildly asymmetric, in accord with the persistence of an anisotropic bonding environment within the liquid. Evolution of powder diffraction patterns up to the temperature of melting revealed the stability of the ambient-pressure hcp structure up to a pressure of 10 GPa. The melting curve has a positive Clausius-Clapeyron slope, and its slope is in good agreement with data from other techniques. We find deviations in the melting curve from Lindemann law type behavior for pressures above 1 GPa.