This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Does compiler initialyse variables to zero?

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

Parents
  • 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.

Reply
  • 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.

Children