Error while returning

src/energy.c:152:12: warning: ‘minenergyindex’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  152 |     return toreturn;
      |            ^~~~~~~~

Even though my code works and passes the public test, it is throwing an error like that. Could you please help me to understand what kind of problem I’m having?
Thank you!

toreturn = minenergyindex;

I need to let you know about this line also, and all of them are already defined.