What do arrays allow us to do?
Arrays allow us to group together a number of variables in a single statement.
Give an example of an array for 4 note numbers.
std::array notes; (instead of) int note1; int note2; int note3; int note4;
What is the general form of an array?
Describe template initialisation.
Template initialisation is basically a way to tell the compiler what kind of array we want.
What is reading and writing achieved by?
[ ] the square brackets
What is the size function?
A class method for the std::array class, and returns the number of elements in the array. - array.size()
How do you make a variable const(read only)?
To make a variable const (read only) we use the const keyword in front of the variable type. Once a variable has been set as const, its value cannot be changed.
What are the two main uses of const?
Preventing errors
How else can you define constant values?
with the define keyword
- The general form of a define is: #define SYMBOL value
What is an enum?
An enum is shorting for enumeration and
allows a series of constant symbols to be defined in a series, whereby each enums value is +1 of the previous value.
Give an example of an enum.
enum waveTypes {
eSine = 0;
eSquare,
eSaw,
eReverseSaw,
eTri,
eNoise,
};