if (arrayLength % 2 == 0) //ERROR: invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’
The type of "arrayLength" is a double and I guess you can't find the modulo of a double and int. I tried changing the 2 to 2.00 as well as creating a double with the value of 2 so that both values are doubles and neither worked. arrayLength must be a double in order for the result to be accurate.