I'm doing something stupid again and i'm not seeing it. Ive attached the whole program and a text file in case anyone wants to try it but here's my problem:
all works fine until I try to call 'calculate' from main. I'm getting the 'cannot resolve symbol variable' and I don't understand why. This all worked when I tried it in a program by itself.
In the main method i have: calculate(dataArray);
To call:
public static void calculate( int dataArray[]){
int[] tempHolding = new int [dataArray.length];
calculate(dataArray, tempHolding, 0); // call private calculate function and pass perameters
}
private static void calculate(int dataArray[], int tempHolding[], int last){
for (int i = last; i < dataArray.length; i++){
tempHolding[i] = dataArray[i];
calculate(dataArray, tempHolding, i +1);
tempHolding[i] = 0;
}
for (int i = 0; i < tempHolding.length; i++){
if (tempHolding[i] != 0){
System.out.print (tempHolding[i] + " ");
}
System.out.println();
} //END OF RECURSIVE ADDITION
Bookmarks