I'm currently learning C++ as of yesterday and I have come across this new thing called an array. All I know about them so far is that they can hold data in a sort of table aspect and you can modify/read the data that they hold.
Since I'm experimenting with C++ I thought I would try to break it and it made me ask this question right now. When I try to read from a value that isn't specified, I get a number and I'm not sure why it is being caused.
int lotteryNumbers[5] = {10, 20, 30, 40, 50};
// Yes, I know that the loop count is 5!
for (int loopCount = 0; loopCount <= 5; loopCount++) {
cout << lotteryNumbers[loopCount] << endl;
}
My output is;
10
20
30
40
50
13439729 <-- What is this sourcery?!
Any help would be much appreciated to guide me learning this complicated language.
Thanks, Nathan.
EDIT: THANK YOU FOR YOUR HELP. NOW MARKED AS DUPLICATE. :D