TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARIN MCBRIDE
from: NEIL HELLER
date: 1997-08-10 07:54:00
subject: PRINTING POINTER VALUES

NH> char aStr[10] = "abcdefgh";
NH> char * aPtr = &aStr[5];
 
NH> cout << aPtr << endl;
DM> You want:
 
DM> cout << (void*)aPtr << endl;
Just an honest question:  why, after aPtr was declared to be a pointer
to char, would you need to cast it in order to print the address
(contents of the pointer).
Instead of a C-style cast, would it be preferred in that situation to
do:
cout aPtr << end;
 * KWQ/2 1.2i * 
--- TMail v1.31.5
---------------
* Origin: Diablo Valley PCUG-BBS, Walnut Creek, CA 510/943-6238 (1:161/55)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.