Explore Westonci.ca, the leading Q&A site where experts provide accurate and helpful answers to all your questions. Ask your questions and receive detailed answers from professionals with extensive experience in various fields. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

How can I pass the variable argument list passed to one function to another function.

Sagot :

Answer:

Explanation:

#include <stdarg.h>  

main()  

{  

display("Hello", 4, 12, 13, 14, 44);  

}  

display(char *s,...)  

{  

va_list ptr;  

va_start(ptr, s);  

show(s,ptr);  

}  

show(char *t, va_list ptr1)  

{  

int a, n, i;  

a=va_arg(ptr1, int);  

for(i=0; i<a; i++)  

 {  

n=va_arg(ptr1, int);  

printf("\n%d", n);  

}  

}