I don’t understand why this code is worked.
int f(int,int);
int main()
{
f(12,21);
return 0;
}
int f(int,int b)
{
return 0;
}
How can i use first arg in function f(…) ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Parameter names are not part of the function signature, only its name and the parameters’ types are.
Therefore, it’s perfectly legal not naming your parameters. However, you can’t use them. (unless of course you do some hacking)
Some hacking: Note – not platform independent, not guaranteed by the standard, but fun 🙂
This works for me on Win7, with MSVS 2008. The code is dependent on how parameters are pushed on the function argument stack.
In production code, you should use names for all parameters, including in declarations, and make them as descriptive as possible.