What is the output of the code segment shown
at right when function testf1() is called?
A) 0 0 0
B) 1 1 1
C) 0 1 2
D) 1 2 3
void f1( int y)
{
static int x=1;
cout << x++ << " ";
}
void testf1()
{
for( int x=0; x<3; x++) {
f1( x);
}
}

Q&A Education