-
What is the output of this program?
#include
using namespace std;
void Output()
{
static int p = 1;
int k;
for(k=p; k<=3; k++)
{
p++;
cout << p;
}
}
int main()
{
Output();
Output();
Output();
return 0;
}
-
- 0123
- 123
- 234
- 012345
- 01234
Correct Option: C
The variable that is declared as static has a file scope.