Home » C++ Programming » Introduction » Question
  1. What is the output of this program?
    #include 
    #include
    using namespace std;
    void function(std::string message, ...);
    int main()
    {
    function("InterviewMania", 5, 7, 10, 8, 9);
    return 0;
    }
    void function(std::string message, ...)
    {
    va_list ptr;
    int number;
    va_start(ptr, message);
    number = va_arg(ptr, int);
    number = va_arg(ptr, int);
    cout << number;
    }
    1. InterviewMania
    2. 5
    3. 7
    4. 8
    5. Compilation Error
Correct Option: C

In this program, we are moving the pointer to the second value and printing it.



Your comments will be displayed only after manual approval.