 <p>Just change your loop to:</p> <pre><code>for (pos = s.begin(); pos != s.end(); ++pos) { cout &lt;&lt; static_cast&lt;void*&gt;( &amp;*pos ) &lt;&lt; endl; } </code></pre> <p><code>static_cast</code> is necessary because <code>&amp;*pos</code> has type <code>char *</code> which would be printed by <code>std::ostream</code> not the way you want.</p>