Before main(): The Secret Life of Global Variables in C
摘要
Most C programmers believe their program starts executing at main(), but this assumption misses a fascinating and complex initialization process that happens beforehand. Before your first line of main() runs, the system has already performed substantial work to prepare your program's environment. Global variables have been initialized, memory has been allocated, and various startup routines have executed to create the foundation your program needs.