Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
void dumplist(int, ...);
5.
int main()
6.
{
7.
dumplist(2, 4, 8);
8.
dumplist(3, 6, 9, 7);
9.
return 0;
10.
}
11.
void dumplist(int n, ...)
12.
{
13.
va_list p;
14.
int i;
15.
va_start(p, n);
16.
while (n-->0) {
17.
i = va_arg(p, int);
18.
cout
Options:
A .  2436
B .  48697
C .  1111111
D .  compile time error
Answer: Option B

In this program, we are eradicating the first value
by comparing using while operator.
Output:
$ g++ rka3.cpp
$ a.out
48697



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers