Question
1.
#include
2.
using namespace std;
3.
void addprint()
4.
{
5.
static int s = 1;
6.
s++;
7.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
void addprint()
4.
{
5.
static int s = 1;
6.
s++;
7.
cout
Answer: Option A
Was this answer helpful ?
The variable that is declared as static has a file scope.
Output:
$ g++ dec2.cpp
$ a.out
234
Was this answer helpful ?
Submit Solution