Array is printing out odd
<p>I just started picking up C++ and this might be painstakingly obvious, but I can't see where I went wrong.</p>

<p>Code I am using:</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

int main(){
cout &lt;&lt; "Hello World" &lt;&lt; endl;
int nums[10];
for(int i = 0; i &lt; 10; i++){
    cout &lt;&lt; "What is number [" &lt;&lt; i &lt;&lt; "]?";
    cin &gt;&gt; nums[i];
}
cout &lt;&lt; "[";
for(int i = 0; i &lt; sizeof nums; i++){
    cout &lt;&lt; nums[i];
    if(i != 9){
        cout &lt;&lt; ", ";
    }
}
cout &lt;&lt; "]" &lt;&lt; endl;
system("pause");
return 0;
}
</code></pre>

<p>The odd thing is, is what it prints out. It appears to be printing numbers not added to the list, not to mention the size of the array is changed.</p>

<pre><code>Hello World
What is number [0]?1
What is number [1]?2
What is number [2]?3
What is number [3]?4
What is number [4]?5
What is number [5]?6
What is number [6]?7
What is number [7]?8
What is number [8]?9
What is number [9]?10
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10-858993460, -1350793456, 7535712, 20404297, 1, 11965848, 11959520, -1350793376, 0, 0, 2131394560, -1920, 561088457, 0, 7536640, 0, 7535652, 0, 7535784, 20386067, -1371958688, 0, 7535720, 20404797, 7535732, 1993246019, 2131394560, 7535800, 1999678569, 2131394560, ]
Press any key to continue . . .
</code></pre>

<p>If anyone could provide insight as to where this program went wrong that would be great!</p>

<p>Thanks,</p>

<p>~Legend</p>
