Arrays are super important for storing data in games, especially maps. Review what an array is and what they look like in code. Explain how to iterate through an array using a for loop. When is it best to use a set of variables versus an array? Why would you want to use an array, and not just a series of variables?
An array is a variable of any type that can store what you need. They would go above main and look like this:
int array[5];
The for loop would go above the array and you out how big your array is in the for loop like this:
for(int i = 0; i<0;i++)
array[i];
It is best when you have to input multiple things, and you would use array instead a set of variables because it is easier.
No comments:
Post a Comment