H
Huibuh
I start hating RETURN!!!
list<happy> //#include <list>// is searched via iterator (ptr) so long
until the argument "number" of the class "happy" is equal now.
The function "findhappy" works fine, finds the right pointer "nownumber"
with correct values.
Behind "return" the memory address remains correct but the values are
wrong (a huge negative number and all the same).
Tried to define "nownumber" and "ptr" as locals OR
to submit them as parameter to the function "findhappy" OR
to define them globally. In any case I always have the same problem.
Any solutions????
Thanks in advance
//THIS WAS MY LAST TRY
happy* findhappy (list<happy> a, int now)
{
ptr=a.begin();
nownumber=ptr.operator ->();
while (nownumber->number!=now)
{
ptr=ptr.operator ++();
nownumber=ptr.operator ->();
}
return nownumber;
}
list<happy> //#include <list>// is searched via iterator (ptr) so long
until the argument "number" of the class "happy" is equal now.
The function "findhappy" works fine, finds the right pointer "nownumber"
with correct values.
Behind "return" the memory address remains correct but the values are
wrong (a huge negative number and all the same).
Tried to define "nownumber" and "ptr" as locals OR
to submit them as parameter to the function "findhappy" OR
to define them globally. In any case I always have the same problem.
Any solutions????
Thanks in advance
//THIS WAS MY LAST TRY
happy* findhappy (list<happy> a, int now)
{
ptr=a.begin();
nownumber=ptr.operator ->();
while (nownumber->number!=now)
{
ptr=ptr.operator ++();
nownumber=ptr.operator ->();
}
return nownumber;
}