Receiving Error "member function must be called or its address taken in function" in C++
<p>I am trying to write a program to do various things with a struct array, and I'm having trouble with the functions. I keep getting error E2235 "Member function must be called or its address taken in function read(student *, int)" and I'm not really sure what's causing this error. My code is as follows:</p>

<pre><code>#include &lt;iostream.h&gt;
#include &lt;fstream&gt;
struct student{
    string first;
    string last;
    string id;
    double GPA;
    int age;
};
void menu();
void read(student* data, int x);
int main(){

bool quit=false;
char choice;
student data[20];
cout&lt;&lt;"Welcome!"&lt;&lt;endl;
//the program is menu driven, so a switch statement allows for many choices
while(!quit){
    menu();
    cin&gt;&gt;choice;
    switch(choice){
        case '1': read(data, 20); break;
        case '2': break;
        case '3': break;
        case '4': break;
        case '5': break;
        case '6': break;
        case '7': break;
        case '8': cout&lt;&lt;endl&lt;&lt;"Goodbye!\n"; quit=true; break;
        default: cout&lt;&lt;"I think you're doing it wrong. Please try again.";
        }
    }
} 

//menu output so the user knows what they're doing
void menu(){
    cout&lt;&lt;endl;
    cout&lt;&lt;"What would you like to do?"&lt;&lt;endl;
    cout&lt;&lt;"(1) - Read data into the database"&lt;&lt;endl;
    cout&lt;&lt;"(2) - Add a student"&lt;&lt;endl;
    cout&lt;&lt;"(3) - Remove a student"&lt;&lt;endl;
    cout&lt;&lt;"(4) - List all students"&lt;&lt;endl;
    cout&lt;&lt;"(5) - Compute the average GPA and SD of the database"&lt;&lt;endl;
    cout&lt;&lt;"(6) - View Student Information"&lt;&lt;endl;
    cout&lt;&lt;"(7) - Save the database"&lt;&lt;endl;
    cout&lt;&lt;"(8) - Exit"&lt;&lt;endl;
}

//the problem function
void read(student* data, int x){
    ifstream infile;
    infile.open("StudentStruct.txt");
    int k=0;
    string first, last, id;
    double GPA;
    int age;
    while(!infile.eof&amp;&amp;k&lt;x){
        infile&gt;&gt;first;
        data[k].first;
        infile&gt;&gt;last;
        data[k].last;
        infile&gt;&gt;id;
        data[k].id;
        infile&gt;&gt;GPA;
        data[k].GPA;
        infile&gt;&gt;id;
        data[k].age;
        k++;
    }
    cout&lt;&lt;"The database now contains "&lt;&lt;k&lt;&lt;" data entries from 'StudentStruct.txt'"&lt;&lt;endl;
}
</code></pre>

<p>What could be causing this error, and how should I fix it?</p>
