--- test.cpp.old 2008-07-26 16:19:08.000000000 -0600 +++ test.cpp 2008-07-26 16:22:59.000000000 -0600 @@ -41,8 +41,8 @@ return 0; double** getPounds() { - double **ptrPounds; - double pounds[MONKEYS][DAYS]; + double (*pounds)[DAYS] = NULL; + pounds = new double[MONKEYS][DAYS]; int num = 0; int num2 = 0; @@ -58,8 +58,7 @@ double** getPounds() cin >> pounds[num2][num]; } } - ptrPounds = (double**)pounds; - return ptrPounds; + return (double **)pounds; } //*************************************** @@ -74,11 +73,12 @@ double averageFood( double** pounds, int { double total = 0; double avgFood; + double (*p)[DAYS] = (double (*)[DAYS]) pounds; for ( int num = 0; num < DAYS; num++ ) { for ( int num2 = 0; num2 < MONKEYS; num2++ ) - total += pounds[num2][num]; + total += p[num2][num]; } avgFood = total / static_cast(DAYS); return avgFood;