Here's my error when g++'ing: "error: invalid types `double*[double]' for array subscript". If any one can help me with this, please! I've been trying for half an hour now, but don't get it. I got this error before, but can't remember for my life what it was about. Thanks in advance!
Edit: Error found! Yay 8)
should be
. Why? Beats me!
Code:
#include <iostream>
using namespace std;
double max(double array[], double start, double end);
main () {
double num[10];
cout <<endl;
populate (num, 0, 9);
max (num, 0, 9);
cout <<endl;
}
double populate (double array[], double start, double end)
{
double num[10];
for (int i=0; i<=end; i++)
{
cout <<"Enter digit " <<i+1 <<": " ;
cin >> num[i];
}
cout <<endl;
}
double max (double array[], double start, double end)
{
double num[10], maximum=array[start]; //ERROR HERE!?!
for (int i=0; i<=end; i++)
{
if (num[i] > maximum)
maximum = num[i];
cout <<maximum;
}
cout <<endl;
}
Edit: Error found! Yay 8)
Code:
maximum=array[start]
Code:
maximum=array[0]