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
Who is the founder of c language?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Where static variables are stored in c?
What is difference between class and structure?
What is the use of header files?
What is c language & why it is used?
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.
Explain how can you tell whether a program was compiled using c versus c++?
What is nested structure in c?
What is a memory leak? How to avoid it?
What are the rules for the identifier?
What is the use of bitwise operator?
What is chain pointer in c?
What are the different properties of variable number of arguments?