-1

What is the problem int the code? I've got:

"error: expected primary-expression before 'j'"

#include <vector>
using namespace std;

void foo(vector<int>& v){  
}

int main()
{
   foo( vector<int> j);
   return 0;
}
user3781974
  • 113
  • 7

1 Answers1

1

This is invalid:

foo( vector<int> j);

because you just can NOT define a named variable in a function call....

you mean for sure

int main()
{
    vector<int> j;
    foo(j);
    return 0;
}
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97