469,626 Members | 1,615 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

multiple parameters with vectors

cdg
Is there any reason why code passing multiple parameters with a vector
is not legal.
I have left out most of the unneccessary details to try and make the
problem clearer. Earlier in the program the vector is passed without any
problems, but it was the only parameter.

#include <iostream>
#include <vector>
using namespace std;

void CompareValues(vector<int>& cards,int,int); //prototype

void main()
{

}

void AnotherFunction()
{
CompareValues(vector<int>& any_vector, result, ct); //function call
//*** I am getting an error message here, saying
// "illegal use of this type as an expression"
}

void CompareValues(vector<int>& any_vector, int result, int ct)
{

}
Mar 5 '06 #1
3 2180
cdg
This is the correct code to show the problem. There were different vector
names in the previously posted code that I had changed just to post the
problem with multiple parameters.

#include <iostream>
#include <vector>
using namespace std;

void CompareValues(vector<int>& any_vector,int,int); //prototype

void main()
{

}

void AnotherFunction()
{
CompareValues(vector<int>& any_vector, result, ct); //function call
//*** I am getting an error message here, saying
// "illegal use of this type as an expression"

}

void CompareValues(vector<int>& any_vector, int result, int ct)
{

}
Mar 5 '06 #2
cdg a écrit :
Is there any reason why code passing multiple parameters with a vector
is not legal.
I have left out most of the unneccessary details to try and make the
problem clearer. Earlier in the program the vector is passed without any
problems, but it was the only parameter.

#include <iostream>
#include <vector>
using namespace std;

void CompareValues(vector<int>& cards,int,int); //prototype

void main()
{

}

void AnotherFunction()
{
CompareValues(vector<int>& any_vector, result, ct); //function call


Try

CompareValues(any_vector, result, cnt);

Do not put the argument type in the function call.
Mar 5 '06 #3
cdg
I tried it and it did work. And I actually had written it correctly
earlier in the program, but I didn't notice it this time.
Mar 5 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steven K | last post: by
21 posts views Thread by utab | last post: by
5 posts views Thread by xtheendx | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.