Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When do I need to initialise variables?

initialise variables
0
10 Posted

When do I need to initialise variables?

0

• (REG) All variables should be initialised (implicitly or explicitly) before they are read from. Automatic variables are placed on the stack, and thus will have a random initial value. This means that you need to manually initialise them. Static variables are placed in the .bss section, which is initialised to zero by the kernel (at the start of the boot sequence). If the initial value of a static variable should be zero, you don’t need to do anything. If it should be a non-zero value, you will need to initialise it. Note that you should not explicitly initialise a static variable to zero, as this will increase the size of the kernel image, which causes problems for embedded systems.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123