Click here to Skip to main content
15,499,289 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am sorry for the misleading title , but I cannot recall the exact term
There is a way to pass unspecified number of parameters to a function.
I think the syntax is

function(parameter...parameter)

the parameters must be of same type

Anyway . if somebody can kindly give me the correct term I can ask Mrs Google.

Cheers

What I have tried:

I did ask Mrs Google - no good without correct term
Posted
Updated 9-Jan-22 9:02am
v3
Comments
Rick York 8-Jan-22 12:24pm    
You have the answer but it is important to note that the arguments are not required to be of the same type.

What you're talking about is called a Variadic Function[^].
 
Share this answer
 
It's called variable arguments, and it's pretty simple: C - Variable Arguments[^]
 
Share this answer
 
Comments
Member 14968771 8-Jan-22 16:00pm     CRLF
OK, I did check this https://www.tutorialspoint.com/cprogramming/c_variable_arguments.htm It states that "first argument has to be "int" to specify number of arguments being passed. Then if gives an example and the first argument is 1 in both of them. What gives ?
OriginalGriff 8-Jan-22 16:21pm    
Did you check the actual examples at the bottom of the page?
Member 14968771 8-Jan-22 17:08pm     CRLF
No, I just checked the first one...but I got the concept. I was using QString but I need to convert it to pointers, maybe even array of pointers. Then I won't need this variadic function....
Member 14968771 8-Jan-22 17:15pm     CRLF
Checked it - the last example has the counter as first, the top has it as last - in the text. So my take is - does anybody czech their articles before posting? But the count does not matter - it can be czeched in function itself. ( oh yes - what do I expect for free..._

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900