Discussion :: Variable Number of Arguments - True / False Questions (Q.No.5)
A function that receives variable number of arguments should use va_arg() to extract the last argument from the variable argument list.
Answer: Option B
No answer description available for this question.
|Raj said: (Jul 30, 2011)|
|Can anyone pls tell how to extract the last arguement from the variable argument list?|
|Champ said: (Dec 1, 2011)|
|Use va_end() for that.
The va_end() function destroys the variable argument list pointer p, rendering it invalid unless va_start() is called again.
|Sumit said: (Feb 1, 2014)|
|The va_end() function destroys the variable argument list pointer p, rendering it invalid unless va_start() is called again.
So to access last argument va_arg is used before va_end.
I think so.
|Chandu said: (May 27, 2014)|
|Can any one explain this concept with one practical example please?|
|Subra said: (Jan 5, 2017)|
|To access any elements we should av_arg().
va_end will return void so va_end is not used to extract last elements instead it used to destroy the va_list type ptr we created.
|Zaid said: (Mar 9, 2017)|
|To extract the last argument we still need va_arg(), va_end() cleans up the list, it doesn't extract the last argument for us.|
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.