Examveda

What will be the output of the following C++ code?
#include <iostream>
#include <stdarg.h>
using namespace std;
void dumplist(int, ...);
int main()
{
    dumplist(2, 4, 8);
    dumplist(3, 6, 9, 7);
    return 0;
}
void dumplist(int n, ...)
{
    va_list p;
    int i;
    va_start(p, n);
    while (n-->0) 
    {
        i = va_arg(p, int);
        cout << i;
    }
    va_end(p);
}

A. 2436

B. 48697

C. 1111111

D. compile time error

Answer: Option B


Join The Discussion

Related Questions on Functions and Procedures in C plus plus