I'm learning c++ and doing some exercise from a book right now. I'm asked to write definition of enum which takes 3 values (forward, backward, stop) and array of 15 elements of this type. In this definition I have to set values of first 5 elements of this array. I did it without problems, but it made me think.. If I write:
enum move {FORWARD = 1, BACKWARD, STOP};
move array[15] {FORWARD, BACKWARD, STOP, STOP, STOP};
... first 5 elements will have values of 1, 2, 3, 3, 3 but all after that will have 0. How is it possible since "move" can't take values other than 1, 2 or 3? Why is the rest of array initialized anyway if I specified just first 5 fields? Or maybe it just means those are empty fields?
Please explain in simple way so beginner like me can understand :), thanks.