# in C is a pre processor directive..It signifies compiler action, not associated with code generation
## is used to concatinate the numbers
Ex: 3##4 gives an output 34
Ellipsis in c (...): It is used in formal argument lists of function prototypes to indicate
variable number of arguments or arguments with varying types
void fun(int n,char ch,...)
This declaration indicates that fun will be defined in such a way that calls must have
atleast two arguments, an int and a char, but can also have any number of additional
arguments.
In c++ you can omit the comma(,) preceding the ellipsis
The prototype of printf is
## is used to concatinate the numbers
Ex: 3##4 gives an output 34
Ellipsis in c (...): It is used in formal argument lists of function prototypes to indicate
variable number of arguments or arguments with varying types
void fun(int n,char ch,...)
This declaration indicates that fun will be defined in such a way that calls must have
atleast two arguments, an int and a char, but can also have any number of additional
arguments.
In c++ you can omit the comma(,) preceding the ellipsis
The point to be noted is printf works, even
though we are able to pass a number of arguments to it. If we design a
function which takes two arguments and pass three parameters, we would definitely get the error “too many arguments to function”
fun(int a, int b)
fun(2,3,4) is not possibleIf printf or scanf has got variable no.of arguments...!
The prototype of printf is
int printf(const char *str,...)
No comments:
Post a Comment