num_students is a local variable in main function which is initalized to zero. After calling the function read_calcData the variable num_students will be zero because you have not passed the address of num_students to the function read_calcData where the number of students is calculated.

The num_students variable is local to read_calcData the variable looses its scope as soon as the function read_calcData is executed.

num_students is a local variable in main function which is initalized to zero. After calling the function read_calcData the variable num_students will be zero because you have not passed the address of num_students to the function read_calcData where the number of students is calculated.

The num_students variable is local to read_calcData the variable looses its scope as soon as the function read_calcData is executed.

How do I pass the address of num_students to the function, and how do I make num_students retain its value when it gets displayed in my displayStats function? Do I have to include a & and call by reference? I tried this but it just gave me more errors.