Sunday, August 18, 2013

What is wrong with this code?

string FindAddr( list emps, string name )
{
  for( list::iterator i = emps.begin();
       i != emps.end();
       i++ )
  {
    if( *i == name )
    {
      return i->addr;
    }
  }
  return "";
}

1 comment:

  1. string FindAddr( list emps, string name )
    should be
    string FindAddr( const list& emps, const string& name )

    Fabioang@gmail.com

    ReplyDelete