1/11/00
COM1100 Winter2000 Yuhong Yin Northeastern University
27
Garbage in, Garbage out
nIf an identifier has not been initialized before it is used, the compiler may notice the error and notify the programmer, or it may ignore the fact and use the garbage that appears in the memory space assigned to the identifier.
nGarbage in, Garbage out
nint m=7,n=m, q;
ncout << "m = " << m << endl; // m = 7
ncout << "n  = " << n  << endl; // n = 7
nq = q + n;  // q doesn’t have any value
ncout << "q  = " << q  << endl; // q = -858993453
n