We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I'm new to this forum and would like to know if the Keil compiler sets declared global and local variables to zero.
If not, is there some command line option to achieve this?
Thanks,
Henk
http://www.keil.com/support/man/docs/c51/c51_ap_startup.htm
local variables to zero.
Local variables are uninizialized by default. The C standard does not require them to be initialized - it's up to the programmer to take care of that.
Global variables are initialized to zero during execution of the startup code. To modify this behavior, modify the startup file accordingly.
If you check the startup module you see the code that clears the memory. If you need to you can modify it to do other stuff like initialise all uninitialised non-local variables to another value.