An array is out of bound crash

Any of your array overflows, especially you are taking base of your T array.
Lets assume that T.num() = 30 and H.num(),FW.num(),NH.num(),NFW.num() should bigger than ‘30’.

What if they smaller, lets assume that your T.num() = 30 and H.num() = 6 and your index goes until 30. When your index i=7 will check for H[7], but H only have 6 members, there is no H[6] ‘kaboom’. Index out of bounds…
Little note here : indexes starts from 0. 0,1,2,3,4,5 = 6 members.

Please debug if your other arrays bigger than it.

Or… Add line as :

 for (int i = 0; i != T.Num(); ++i)
     {
         // this will break your for loop in case of problem in overflow.
         // you can do different checks in different places in for loop.
         // rest is related with your design.
         if (i >= H.num() || i >= FW.num() || i >= NH.num() || i >= NFW.num())
              break

         ToVapor = VaporRate * a * T[i] + b;
         if (FW[i] == 0)
         {
             NH[i] *= ToVapor;
             NFW[i] = 0;
         .....
1 Like