← Back to Question List
C Code Walkthrough #42
Static Local Variable Persists
📄 Code
Read carefully — what does this print?1#include <stdio.h>2int next() {3 static int count = 0;4 count++;5 return count;6}7int main() {8 int a = next();9 int b = next();10 int c = next();11 printf("%d %d %d", a, b, c);12 return 0;13}