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

Is This Answer Correct ?    8 Yes 2 No

Post New Answer

More C Interview Questions

main() { enum _tag{ left=10, right, front=100, back}; printf("%d, %d, %d, %d", left, right, front, back); }

1 Answers   Accenture, Vector,

What does it mean when the linker says that _end is undefined?

0 Answers  

what is the use of fflush() function?

2 Answers  

What is p in text message?

0 Answers  

Why c is called free form language?

0 Answers  

Explain can static variables be declared in a header file?

0 Answers  

how does the C compiler interpret the following two statements p=p+x; q=q+y; a. p=p+x; q=q+y b. p=p+xq=q+y c. p=p+xq; q=q+y d. p=p+x/q=q+y

2 Answers   TCS, Tech Synergy,

How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

0 Answers  

why u join this call center?

6 Answers   DELL,

what is the difference between getch() and getche()?

7 Answers   Infosys,

pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

0 Answers   Huawei,

how can use subset in c program and give more example

0 Answers