We can't guess with the fragment of code posted. This tutorial section on friend functions might help :
cplusplus.com tutorial friendship & inheritance/[
^]
ETA : actually it is fairly clear what some of the problems are. Here is the code for the function with indentation added :
vector min()
{
vector l;
vector m;
vector temp;
for (int i=0;i<l.n;i++)
m=l.A[0];
for (int j=1;j<l.n;j++)
{
if (l.A[j]<m)
{
temp=l.A[j];
l.A[j] =m;
m=temp;
}
} }
There are several things wrong with this.
- All references to
m
are bad because it is a vector.
- The vector
l
is accessed several times but it is never initialized.
- The variable
temp
is declared as a vector but it should be of the type contained by the vector and that is not clear.
- The function should return a vector but it does not.