Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


How to implement variable argument functions ?



How to implement variable argument functions ?..

Answer / swetcha

Variable-argument functions in C are inherently unsafe
since there is no language-level mechanism to ensure that
the actual arguments agree in type and number with the
arguments that the function will be using. There are
several ways to implement variable argument functions in C

You can try to implement such function by taking the
address of a formal argument and working your way through
the stack frame.A better alternative is to use the
__builtin_next_arg function on gcc and then work your way
up the stack. You can write your variable argument
functions using the standard macros in <stdarg.h> and
<vararg.h>.

Is This Answer Correct ?    8 Yes 2 No

Post New Answer

More C Interview Questions

Once I have used freopen, how can I get the original stdout (or stdin) back?

0 Answers  


What is the function of this pointer?

0 Answers   Agilent, ZS Associates,


what is the Output? int a=4 b=3; printf("%d%d%d%d%d%d",a++,++a,a++,a++,++a,a++); printf("%d%d%d%d%d%d",b--,b--,--b,b--,--b,--b);

10 Answers   IBM,


Linked lists -- can you tell me how to check whether a linked list is circular?

0 Answers  


What is console in c language?

0 Answers  






Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

0 Answers   TCS,


How many levels of indirection in pointers can you have in a single declaration?

0 Answers   Agilent, ZS Associates,


what is the differnce between AF_INET and PF_INET?

5 Answers   Systems Plus, Wipro,


How can you check to see whether a symbol is defined?

0 Answers  


When should volatile modifier be used?

0 Answers  


What is pre-emptive data structure and explain it with example?

0 Answers  


What is hash table in c?

0 Answers  






Categories