How to print contents in vector
<p>I am new to C++. I want to print some values in 'vector'.</p>

<pre><code>vector&lt;GLubyte&gt; m_coneIndices;
m_coneIndices.resize(m_bodyIndexCount + m_diskIndexCount);
vector&lt;GLubyte&gt;::iterator index = m_coneIndices.begin();

// Body triangles
for (int i = 0; i &lt; coneSlices * 2; i += 2) {
    *index++ = i;
    *index++ = (i + 1) % (2 * coneSlices);
    *index++ = (i + 3) % (2 * coneSlices);
}


// Disk triangles
for (int i = 1; i &lt; coneSlices * 2 + 1; i += 2) {
    *index++ = diskCenterIndex;
    *index++ = i;
    *index++ = (i + 2) % (2 * coneSlices);
}
</code></pre>

<p>This is how the values stored in 'vector'. I tried like </p>

<pre><code>cout &lt;&lt; "indices"&lt;&lt; "\n";

for (int i=0; i&lt;(coneSlices * 2 ); i+=2) {

    cout &lt;&lt; m_coneIndices[i] &lt;&lt; ' ' &lt;&lt; m_coneIndices[i+1] &lt;&lt; ' ' &lt;&lt; m_coneIndices[i+2] &lt;&lt; ' ' &lt;&lt; "\n";
}
</code></pre>

<p>and that printed some garbage values. Let me know what is wrong with this code.</p>
