Welcome to Westonci.ca, the Q&A platform where your questions are met with detailed answers from experienced experts. Join our Q&A platform to get precise answers from experts in diverse fields and enhance your understanding. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

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);  

}  

}