www.thecareerplus.com
The CareerPlus
Home Technical Resources Programming Variables and Data types
Thursday 09th September 2010
 
 
Do Global variables start out as zero?

Discuss it!          




Uninitialized variables declared with the "static" keyword are initialized to zero.
Such variables are implicitly initialized to the null pointer if they are pointers,
and to 0.0F if they are floating point numbers.
Local variables start out containing garbage, unless they are explicitly initialized.

Memory obtained with malloc() and realloc() is likely to contain junk, and must be
initialized. Memory obtained with calloc() is all-bits-0, but this is not necessarily
useful for pointer or floating-point values (This is in contrast to Global pointers
and Global floating point numbers, which start as zeroes of the right type).

Discuss it!          

CrackTheIntervew.NET
Advertisement
 
Top! Top!