My function won't compile :(. Any help?

Hi all,

I'm still kind of new to writing functions, and this is one i wrote that is supposed to generate a random numerical code of length "d", with maximum value for each digit of "h" and where "c" is the code.

For example if d=4, h=3, then c could equal 1232, or 1132, or 2333 etc.

Here's my function:

int pickCode(int d, int c, int h);

int pickCode(int d, int c, int h){

using namespace std;

int counter = 0;

int digit;

c = 0;

while (counter<d) {

rand( digit % d + 1);

c = c*10 + digit;

counter = counter + 1;

}

return c;

}