Final answer:
The Sun will resist gravitational collapse through fusion-generated pressure until its hydrogen is depleted, leading to its expansion into a red giant and eventual shrinkage into a white dwarf with a carbon-oxygen core.
Step-by-step explanation:
The future of the Sun is characterized by the continuous battle between gravitational forces trying to compress the Sun and the pressure from fusion within the Sun opposing this compression. The high temperatures needed for fusion in the Sun's core, where hydrogen is fused into helium, come from the conversion of mass to energy, producing gamma ray radiation and creating outward thermal pressure. This pressure is what prevents the Sun from collapsing under its own gravity. Over time, as the Sun depletes its hydrogen supply and fusion ceases, it will expand into a red giant and then collapse into a white dwarf, ending as a carbon-oxygen core. The star will go through phases of expansion and contraction, becoming as large as the current orbit of Mars during its red giant phase and shrinking significantly as it becomes a hot white dwarf.