By the way, what does it mean when you say maxPeak = 0.0? |
Are you asking about line 34?
double maxPeak = 0.0;
?
Creating a
double variable named
maxPeak, initialized to zero.
Why
0.0
?
is an integer, which can be converted to a
double.
0.0
is a double value used to initialize a double variable. No conversion.
The peak array was declared
double, best if any variables dealing with the array also be declared the same.
Similar idea using
unsigned (actually it's
unsigned int) when working with an array's elements. An
int is signed and can hold positive and negative values.
An array's elements can never properly be indexed using a negative number, you would go out of scope.
The fundamental variable types in C++ are explained here (scroll down a bit):
http://www.cplusplus.com/doc/tutorial/variables/