First part:
1. What is an array?
An array is a collection of multiple variables of the same type.
2. Which index would you use to access the 2nd variable in an array?
1
3. What can you say about the size of an array?
The size of an array can be the number of elements it has, or the total byte size of these elements combined.
Second part:
First part:
1. What is an array?
An array is a collection of multiple variables of the same type.
2. Which index would you use to access the 2nd variable in an array?
1
3. What can you say about the size of an array?
The size of an array can be the number of elements it has, or the total byte size of these elements combined.
Second part:
1. How can you initialze an array?
By giving the elements value like this: int array [4] {1,2,3,4}
2. How can you get the size of an array in bytes?
size(array) - will give you the length of the array
sizeof(array) - will give you the total data size of the array (array length*size of element)
3. How can you use the function sizeof in order to calculate the number of elements in an array?
number of elements = sizeof(array)/sizeof(array[0])
4. What happens when you try to write outside of the bounds of the array?
You get undifined behaviour.