Sorry for the unclear question.
Here's the code I'm trying to make sure I understand.
void compareCode(ifstream& infile, ofstream& outfile, constint list[], int length)
Normally when you create a variable you give the type, then the name, and maybe an initialization value- like this :
int length = 51;
In this program, as an example, the parameter int length is not created as a variable anywhere else in the code, either in the main function or in the compare function. So, was that variable created IN the list of parameters for thecompareCode function? Or do parameter lists refer to variables that are created elsewhere?
A function prototype, or a function definition tells the compiler what variables to create as parameters when the function is called. Those variables are created immediately before the function code is executed.
So when the compiler encounters a function call, it will look at the function definition or the function prototype and create the variables specified in the parameter list.
So the variables specified in the parameter list are created every time the function is called and they are destroyed when the function exits.
When you declare a variable as a function parameter, you're saying two things:
1. The function takes this as a parameter.
2. Some stack space should be reserved to hold the value of the parameter.
So, to answer your question,
In this program, as an example, the parameter int length is not created as a variable anywhere else in the code, either in the main function or in the compare function. So, was that variable created IN the list of parameters for thecompareCode function?
Yes. The fact that you included length in the parameter list also reserved memory for it.
Wow THANKS. Now I have it. Galik, you nailed it, just what I was asking. Helios, you added to it in a way that makes me understand the mechanics of it.