How to implement variable argument functions ?
Answer Posted / 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 View All Answers
Explain c preprocessor?
What is meant by errors and debugging?
Explain the use of #pragma exit?
How can you determine the maximum value that a numeric variable can hold?
What are the 4 types of organizational structures?
What is pointer to pointer in c?
Should a function contain a return statement if it does not return a value?
Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?
what are the 10 different models of writing an addition program in C language?
What is the function of this pointer?
Write a program to find the biggest number of three numbers in c?
How can a string be converted to a number?
What is the difference between a function and a method in c?
What is meant by 'bit masking'?
Explain how can you restore a redirected standard stream?