I have a structure sportist
struct sportist{           
    string name;
    string surname;
    int goals;
    string tim;
}
Here is the function that should read the values.
 void read(sportist x[],int n)     
{
    int i;
    for(i=0;i<n;i++)
    {
        cout<<"************************************************"<<endl;
        cout<<"Name:";
        cin>>x[i].name;
        cout<<endl<<"Surname:"; 
        cin>>x[i].surname;
        cout<<endl<<"Goals :";
        cin>>x[i].goals;
        cout<<endl<<"Name of the team:";
        cin>>x[i].tim;
    }
My question is how can I use pointers, because I need to? My attempt:
 void read(sportist* x,int n)
{
    int i;
    for(i=0;i<n;i++)
    {
        cout<<"************************************************"<<endl;
        cout<<"Name:";
        cin>>x->name;
        cout<<endl<<"Surname:"; 
        cin>>x->surname;
        cout<<endl<<"Goals :";
        cin>>x->goals;
        cout<<endl<<"Name of the team:";
        cin>>x->tim;
    }
} 
What I want is to sort the sequence of athletes and teams by the number of goals and print them on the screen to sort them in a popup order. But it shows me errors when I debug.
