Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!usc!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!kenny From: kenny@m.cs.uiuc.edu Newsgroups: comp.lang.c++ Subject: Re: Question Re. cout (Simple) Message-ID: <4800080@m.cs.uiuc.edu> Date: 10 Jan 90 17:29:27 GMT References: <7567@hubcap.clemson.edu> Lines: 25 Nf-ID: #R:hubcap.clemson.edu:7567:m.cs.uiuc.edu:4800080:000:564 Nf-From: m.cs.uiuc.edu!kenny Jan 9 17:54:00 1990 #include #include main() { int* x = new int; *x = 10; cout << "1. x = " << *x << '\n'; cout << "\n"; cout << "2. x = " << *x << "\n"; printf("3. x = %d %c",*x,'\n'); } Question: Why does the first cout (cout << "1. x = " << *x << '\n';) produce the output x = 1010 ?? The '\n', in single quotes, is promoted to an integer before being passed to cout; the ASCII character value for newline is decimal 10. This anomaly was an unavoidable misfeature of the original C++ calculus of types; it's fixed in cfront 2.0, gcc, and zortech. A-T