1.10 What assumptions can be made about the initial value of a variable that is not initialized? If a global variable has an initial value of "0", can it be a null pointer or a floating-point zero?
For:
Uninitialized variables that have a "static" lifetime (that is, variables declared outside the function and variables with static storage types) can ensure that the initial value is zero , just as the programmer types "= 0". Therefore, if the pointer is initialized to the correct null pointer, the floating-point number is initialized to 0.0 (or
See chapter 5th) for the correct type.
Variables that have an "automatic" lifetime (that is, local variables that do not have a static storage type) contain junk content if they are not initialized with a display. You cannot make any useful assumptions about the content of the garbage. These rules also apply to arrays and structures (called "aggregates"); For initialization, arrays and nodes
are considered to be "variables".
Memory allocated dynamically with malloc () and ReAlloc () may also contain garbage data, so it must be properly initialized by the caller. The memory obtained with CALLOC () is all zeros, but this is not necessarily useful for pointers and floating-point values (see Questions 7.26 and 5th).
495 C-language questions you must know notes