mardi 26 décembre 2017

Passing Vector as function argument

To pass vecotrs as function arguments it is recommended to pass them by reference as follows:

void func(vector<int> &A);

But we pass arrays by reference as follows:

void func(int *A,int n);

What is the difference between * and & in these two function declarations?

Aucun commentaire:

Enregistrer un commentaire