One of the uses of ...
is to denote variadic entities in C and C++.
What is its name?
Is it classified as an operator or something else when used in that way?
Any other details regarding ...
?
Edit: I know the purpose of ...
. I am asking about its name and classification, which I hope, is similar in both C and C++.
& means the address-of, you will see that in placeholders for functions to modify the parameter variable as in C, parameter variables are passed by value, using the ampersand means to pass by reference. * means the dereference of a pointer variable, meaning to get the value of that pointer variable.
3. What is this operator called ?:? Explanation: In this operator, if the condition is true means, it will return the first operator, otherwise second operator.
It is one of the punctuators.
6.4.6 Punctuators Syntax punctuator: one of [ ] ( ) { } . -> ++ -- & * + - ~ ! / % << >> < > <= >= == != ^ | && || ? : ; ... = *= /= %= += -= <<= >>= &= ^= |= , # ## <: :> <% %> %: %:%:
In the function declaration it is called the ellipsis.
Ellipsis is also used by some compiler C
language extensions. Example - gcc switch/case range extension
const char *test(unsigned num) { switch(num) { case 0 ... 9: return "the value is in the 0 to 9 range"; case 10 ... 99: return "the value is in the 10 to 99 range"; default: return "out of tested range"; } }
https://godbolt.org/z/YBLma-
The ...
is referred to as an ellipsis both in English and in the C standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With