Dovberman
asked on
How to pass an array to a procedure
I need to pass parameters to a procedure.
What is the syntax for passing an array?
// Declare variables
int[] arrDealtCards = new int[2];
int intHole1 = 5;
int intHole2 = 7;
int intFlop1 = 11;
intFlop2 = 7;
arrDealtCards[0] = intHole1;
arrDealtCards[1] = intHole2;
arrDealtCards[2] = intFlop1;
// Pass variables to the CheckForDup procedure
blnIsDup = CheckForDup(intFlop2, arrDealtCards, 3); // line 81 generates the error
Error 2 The best overloaded method match for 'PreFlopPractice.CheckForD up(int, int, int)' has some invalid arguments C:\Users\Admin\Documents\V isual Studio 2008\WebSites\NoLimitBusin ess\PreFlo pPractice. aspx.cs 81 20 C:\...\NoLimitBusiness\
private bool CheckForDup(int pintDealtCard, arr[] parrDealtCards, int pintCtr)
//Returns True if duplicate is found
{
bool blnIsDup = false;
// This will loop until intFlop2 = one of the earlier cards
int intCtr = 0;
do
{
blnIsDup = (pintDealtCard == parrDealtCards[pintCtr]);
intCtr++;
}
while (!blnIsDup);
return blnIsDup;
}
Thanks,
What is the syntax for passing an array?
// Declare variables
int[] arrDealtCards = new int[2];
int intHole1 = 5;
int intHole2 = 7;
int intFlop1 = 11;
intFlop2 = 7;
arrDealtCards[0] = intHole1;
arrDealtCards[1] = intHole2;
arrDealtCards[2] = intFlop1;
// Pass variables to the CheckForDup procedure
blnIsDup = CheckForDup(intFlop2, arrDealtCards, 3); // line 81 generates the error
Error 2 The best overloaded method match for 'PreFlopPractice.CheckForD
private bool CheckForDup(int pintDealtCard, arr[] parrDealtCards, int pintCtr)
//Returns True if duplicate is found
{
bool blnIsDup = false;
// This will loop until intFlop2 = one of the earlier cards
int intCtr = 0;
do
{
blnIsDup = (pintDealtCard == parrDealtCards[pintCtr]);
intCtr++;
}
while (!blnIsDup);
return blnIsDup;
}
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER