I want to have a function to make a list of binary random numbers.. I don't know which method is appropriate for this purpose. I can make it with an array , a while command, linked list or a std ..
I want to return the whole list from the function. In array i think i can't do that. For example the following function only return the first elements.
long int SourceNode::database(long int chunk_var[])
{
srand ( time(0) );
for(int j = 0; j<50 ;j++)
{
int myrand = rand() % 2 ;
myrand = myrand & 0x3ff;
chunk_var[j]= myrand;
}
return *chunk_var;
}
i want something to return the whole list, because i want to invoke that function( the whole list) in another function . is there any alternative solution instead of making an array?
Aucun commentaire:
Enregistrer un commentaire