I have not got ur question completely ,
1. Passing a struct by ref :
if u have a struct say:
void func(subjectsMarks* obj)
subjectsMarks* p = new subjectsMarks;
p->sub1 = 100;
p->sub2 = 200;
I have not compiled it, but just this might give a rough idea about passing it as a ref.
2. Even if you will use a array, u need to loop & get the average.
Give some snapshot so that we can have a rough idea.