I am having an issue with an integer wrapping around to its minimum value unexpectedly.
The value of the integer is 15 before it wraps to -858993460.
Here is the code that is causing this issue:
while(ArrayLocation2 < EmpArray2Size)
{
GivenEmployees[(*EmployeeSize++)] = curr2;
prev2 = curr2;
if(ArrayLocation2 < EmpArray2Size)
{
curr1 = EmpArray2[ArrayLocation2];
}
ArrayLocation2++;
if((ArrayLocation2 >= EmpArray2Size) || (prev2.HourlyRate > curr2.HourlyRate))
{
subFiles++;
}
}
If I manually change the values that it needs (16, 17, 18, etc) it works as expected.
Size is declared as int Size = 21;
and passed into its current method as &Size if it makes a difference.
Why is this exactly happening?