I
Ivan Paganini
Hello all.
I'm trying to use a vector<double> to alocate de data that i need, and
I am passing by reference to the function to receive the values. The
code goes like this:
//code
void GenerateRandomPositions(vector<double>& posiX, vector<double>&
posiY, int nbneurons, int* sizespace)
{posiX.clear();
posiY.clear();
for(i=0;i<NbNeurons;i++)
{
posiX.push_back((double)(rand()%sizespace[0]+1));
posiY.push_back((double)(rand()%sizespace[1]+1));
}
}
//end code
where i need the values of posiX and posiY returned to the program.
The size of NbNeurons is about 10, and sizespace is a number that the
program gets from the number of coordinates in my database. When i try
to run the program, i get the segmentation fault. What can be the
problem?
Thanks.
Ivan S>P<M
Grupo de Visão Cibernética - IFSC - USP - Br
I'm trying to use a vector<double> to alocate de data that i need, and
I am passing by reference to the function to receive the values. The
code goes like this:
//code
void GenerateRandomPositions(vector<double>& posiX, vector<double>&
posiY, int nbneurons, int* sizespace)
{posiX.clear();
posiY.clear();
for(i=0;i<NbNeurons;i++)
{
posiX.push_back((double)(rand()%sizespace[0]+1));
posiY.push_back((double)(rand()%sizespace[1]+1));
}
}
//end code
where i need the values of posiX and posiY returned to the program.
The size of NbNeurons is about 10, and sizespace is a number that the
program gets from the number of coordinates in my database. When i try
to run the program, i get the segmentation fault. What can be the
problem?
Thanks.
Ivan S>P<M
Grupo de Visão Cibernética - IFSC - USP - Br