04-29-2011, 08:32 AM
void func1(int i) {
static int staticInt=i;
cout<< staticInt << endl;
}
int main() {
func1(1);
func1(2);
}
Output of this code:
1
1
Reason:
Initialization statement will be executed once only as static variables are initialized once.
void fucn1(int i) {
static int staticInt;
staticInt=i;
cout<< staticInt << endl;
}
int main() {
func1(1);
func1(2);
}
Output of this code:
1
2
static int staticInt=i;
cout<< staticInt << endl;
}
int main() {
func1(1);
func1(2);
}
Output of this code:
1
1
Reason:
Initialization statement will be executed once only as static variables are initialized once.
void fucn1(int i) {
static int staticInt;
staticInt=i;
cout<< staticInt << endl;
}
int main() {
func1(1);
func1(2);
}
Output of this code:
1
2
0300-9520262
Get solution in 24 hour |cpmputer & internet
mileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
