I have some code which examines an array to see if it contains a particular value:
boolean found = false;
int []a = new int[100];
populate(a); // populates the array a with a set of random values
int valueToFind = 123; // or whatever we want to find
while((n < 100) && (! found)){
if(a[n] == valueToFind){
found = true;
}
else {
n = n + 1;
}
}
However i'm struggling with re-coding this as a function with parameters and/or a return value to be able to work with any size array.
Then how could I create a second function to give me a value stored in a particular location on the array?
Why is programmin so difficult to learn?! lol
Hope some1 can help, thanks
Steve