← Quiz: C Functions and Recursion: all 10 questions
Quiz: C Functions and Recursion · Question 3 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int next(void) {
static int n = 10;
return n++;
}
int main(void) {
next(); next();
printf("%d", next());
return 0;
}
- A.10
- B.11
- C.12
- D.13
Answer & explanation
Correct answer: 12
The static n keeps its value: calls return 10, 11, then 12.
Can you get the rest right without peeking?
Take the timed Quiz: C Functions and Recursion quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →