In C we can have variadic functions like:
void abc(int x, .. )
{
}
and we can call them with variable number of arguments like:
abc(1,2,3) or abc(1,2,3,4,5)
But, in both of the above function calls, we have called the variadic function abc
with parameters that are already known to us; "1, 2, 3" in the first case and "1, 2, 3, 4, 5" in the second case.
My question is:
Is there any way to call a variadic function with a variable number of arguments inputted by the user during run-time?
For example, in main()
, I ask the user to enter a certain number of inputs and then pass those inputs into the variadic function using parameters p1, p2 , p3 and so on...