Keep your initialization on top of the code (i.e. outside of loop if any).
Check if it is in any loop which is causing it to initialize again.
should be above the code (i.e. outside of loop)
should be inside the loop.
If you want a better answer, attach your code.