Q. What will initialize the list of arguments in stdarg.h header file?

  • (A) va_start
  • (B) va_arg
  • (C) va_list
  • (D) All of above
πŸ’¬ Discuss
βœ… Correct Answer: (A) va_start
Explanation:

In the C standard library <stdarg.h>, used for handling variable argument lists, the roles of each macro/type are as follows:

va_list:
This is a type used to declare a variable that will hold the information needed to retrieve the additional arguments.

va_start(va_list, last_fixed_param):
This initializes the va_list variable so it can be used to retrieve the variable arguments. This is the correct answer to the question.

va_arg(va_list, type):
This retrieves the next argument in the list.

So only va_start is responsible for initializing the list of arguments.

βœ… Correct Answer: (A) va_start

Explanation by: Mr. Dubey

In the C standard library <stdarg.h>, used for handling variable argument lists, the roles of each macro/type are as follows:

va_list:
This is a type used to declare a variable that will hold the information needed to retrieve the additional arguments.

va_start(va_list, last_fixed_param):
This initializes the va_list variable so it can be used to retrieve the variable arguments. This is the correct answer to the question.

va_arg(va_list, type):
This retrieves the next argument in the list.

So only va_start is responsible for initializing the list of arguments.

βœ… Correct Answer: (A) va_start

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
299
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Uday Singh
Publisher
πŸ“ˆ
82%
Success Rate