We have just learned C programming when often encountered "Hot hot hot ironing hot hot hot hot hot hot hot ironing hot hot hot hot ironing hot ironing", this is why.
First from the last time a company written, at that time, there is a test on the issue of variable initialization. Defines an int type value outside the main function (global) and inside (local). And then there's no assignment, just print it out and ask what the output is. That would only know the global default is 0, the local is a negative very large number, but also thought to be the smallest integer. After coming back to try, the local int default is-858993460, or 0XCCCCCCCC.
But why the local default is 0XCCCCCCCC and not the other.
Check some information, found that the version of VC will be uninitialized pointer automatically initialized to 0xCCCCCCCC, rather than let it go randomly, that is because the purpose of the debug version is to enable programmers to find errors earlier, the data on the stack on the initialization of 0XCC, In other words, if the local variable is not initialized, then the debug version will be 0xCC, if the initial value of the wild pointer is uncertain. The Chinese character "hot" code is exactly 1100110011001100, which is why the beginner will appear "hot", because it will often forget to assign value or array out of bounds. While the global variable link has allocated space, when the program runs, the operating system loader, responsible for the linker assigned to the global variables of the virtual memory space, mapped to a zero-initialized page, so was initialized to zero. The global and static default initialization is implemented by the loading mechanism. Also: uninitialized symbols are in the BSS segment of the target file, and the initialized symbol is in the data section.
Local variables exist in (the stack), and global variables exist in the (static area), and dynamic request data exists in (the heap).