472,110 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,110 software developers and data experts.

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 2374
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.