FindMax value

Hello,
Im currently trying to make a simple method for an array that would find the highest value. here is currently what i got, but do not know what to change to make it correct.
1
2
3
4
5
6
7
8
9
double FindMax(double stock[], int size){
	int size = stock.length();
	int max = stock[0];

	for(int i = 1; i < size; i++){
		if (stock[i] > max)
			{max = stock{i};}
	}
	return max;
stock is an array, and does not have a length() method, Just use the size variable you are passing instead of creating another inside the function.
Thank you, i took line number 2 out. I still have an error with line #7 tho. over the equal sign, it says "Error: a value of type "double*" cannot be assigned to an entity of type "int"" and over the second { on line #7, it says " exected a ;". I do not know how to fix either of these.
Nvm. i fixed it. i used {} instead of []. thanks for the help :)
Topic archived. No new replies allowed.