The first generation of stars, also known as Population III stars, were made almost entirely of hydrogen and helium. Later generations of stars, including the Sun, contain heavier elements like oxygen, carbon, and iron, which formed in the cores of earlier stars.