Examveda

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void addprint()
{
    static int s = 1;
    s++;
    cout << s;
}
int main()
{
    addprint();
    addprint();
    addprint();
    return 0;
}

A. 234

B. 111

C. 123

D. 235

Answer: Option A


Join The Discussion

Related Questions on Variables and Data Types in C plus plus