c++ - Looking for clarification regarding array references in function definitions and prototypes -


i idea modify array in function need declare parameter reference in function definition:

bool sortinput(ifstream &infile, studenttype (&students)[maxsize], int size) 

and declared prototype since wouldn't compile otherwise:

bool sortinput(ifstream &, studenttype (&students)[maxsize], int); 

however doesn't seem pass array reference. make call different function , doesn't see of changes (all print array prints nothing). know fact array has been modified because printing within original function shows changes, don't seem carry on global array variable , stay within scope of function modifies despite being passed reference.

i've read countless other threads , google searches i'm sure function definition proper state proper form prototype.

you don't have pass array reference because passed pointer. pass size. in sort function copy of variable size modified in main function zero.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -