In
displayFunction()'s prototype, you specify that a
signed int is required to invoke the function. However, in
main(), you invoke the function without passing anything. Besides, a parameter without an identifier is untouchable and therefore, is useless. You have three options here:
- Omit the parameter altogether
- Specify an identifier for the parameter so that you can access it
- Specify an identifier for the parameter and give it a default argument
The second option requires an argument when the function is invoked. The third option doesn't require an argument when the function is invoked, because the compiler will use the default one (unless you overwrite it).
Edit: Examples would probably help you here.
Option 2:
1 2 3 4 5 6
|
void MyFunction(int Parameter);
int main()
{
MyFunction(10); // 10 is required here.
}
|
Option 3:
1 2 3 4 5 6
|
void MyFunction(int Parameter = 10); // 10 is the default argument.
int main()
{
MyFunction();
}
|
In the latter code, the compiler will use the default argument (10). This means that you don't have to pass a value to
MyFunction() when you call it. However, if you do pass a value, it'll override the default argument in favour of the one you specified at the call site.
Wazzak