CPPForSchool.com: User Defined Function Set 1: Assignment 10
10.
Write the output of the following program :
#include <iostream>
using namespace std;
static int i = 100;
void abc()
{
static int i = 8;
cout << "first = " << i++ << endl;
}
int main()
{
static int i = 2;
abc();
cout << "second = " << i << endl;
abc();
return 0;
}
-----------------------------------------------------
first = 8
second = 2
first = 9

Comments
Post a Comment