1. What is an array?
Array is a collection of variable of same type. It allows to store same data type values at its indexes.
2. Which index would you use to access the 2nd variable in an array?
3. What can you say about the size of an array?
Array size is the number of indexes it has or how many varibles it can store. For fix size array it is placed between ‘[’ and ‘]’.
1. How can you initialize an array?
By assigning element value or via initializer list
2. How can you get the size of an array in bytes?
With sizeof(array). This gives us
array size = array length * element size
3. How can you use the function sizeof in order to calculate the number of elements in an array?
sizeof(array) / sizeof(array);
4. What happens when you try to write outside the bounds of the array?
We won’t get IndexOutOfBound Exception like Java. We will get undefined behavior as the out of bounds value may overwrite the existing value in that memory location.