Hi guys,
I am looping through an array to print the values I entered in another loop before. The first method (showNombre()) returns a char array, the second one and Int.

Problem is my second one showEdad() is returning the address of the int and not the value entered before.

Here is the loop retrieving the info, p is a pointer to animal class, and ob[] is an array of the class.

for(int y=0; y<x; y++)
        p = &ob[y];
        cout << "Nombre: " << p->showNombre() << endl;
        cout << "Edad: " << p->showEdad() << endl;

Here below I post the loop for entering the data, it runs good so far.

for( int i=0; i<x; i++ )
        cout << "Nombre: ";
        getline(cin, n);
        cout << "Edad: ";
        getline(cin, temp);
        if( ! ( istringstream(temp) >> e) ) e = 0;


Any help is appreciated

Try instantiating a istringstream

istringstream iss(temp); //before line 7
if(!(iss >> e)) e = 0;