The Size in int & ampSize is also a reference, pointing to the int type, and its purpose is also to modify the value of the referenced parameter.
Fstream is a file stream type in C++, which can be read and written. You can pass in an object of type fstream, and the purpose of the function is to modify the content of the original parameter, and the reference will not copy the parameter.
For the use and introduction of references, please refer to:
/weiqubo/archive/2009/08/ 10/443 1062 . aspx
If C++ is allowed, it can:
# include & ltiostream & gt
# include & ltfstream & gt
# include & ltvector & gt
# include & lt iterator & gt
# include & lt algorithm & gt
Use namespace std
int main(){
Fstream file ("task. txt");
Vector & ltint & gtivec
copy(istream _ iterator & lt; Int> (file), istream _ iterator & ltint & gt (), back _ inserter(ivec)););
copy(ivec.begin(),ivec.end(),ostream _ iterator & ltint & gt(cout," \ n "));
Returns 0;
}
The purpose of the above program is to read all the contents of task.txt and then output a number per line.
The first address of the array you want can be passed through &; Ivec[0], whose length is ivec.size ().