The source of energy in sun or stars is the nuclear fusion of light nuclei (such as hydrogen) present in them in core at very high temperature(107 K) and pressure.
In this process, four hydrogen nuclei fuse to form a helium nucleus with a release of 26.7MeV.