What is the output? void f() {
What is the output?
void f() {
static int c = 0;
c++;
printf("%d ", c);
}
/* f() is called three times */
Show answerHide answer
Correct answer: (D) 1 2 3
Explanation
A static local keeps its value between calls.
Correct answer: (D) 1 2 3
Explanation
A static local keeps its value between calls.
This is question 137 of DSSSB TGT Computer Science Full Mock Test 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.