What is variable number of arguments in C
A function in which we can pass variables numbers of argument in function call statement such functions are known as function with variable number of arguments.
Try out this example:-
void display(int,...);
void main(){
display(1,2);
display(1,2,3,4);
display(1,2,3,4,5,6,7,8,9);
getch();
}
void display(int x,...){
}
In above example, consecutive dot is known as ellipsis in c.
Try out this example:-
void display(int,...);
void main(){
display(1,2);
display(1,2,3,4);
display(1,2,3,4,5,6,7,8,9);
getch();
}
void display(int x,...){
}
In above example, consecutive dot is known as ellipsis in c.
Comments
Post a Comment