C storage Classes and Type Qualifiers | Q - 6

Last Updated :
Discuss
Comments

What will be the output of the following code?

C
#include <stdio.h>

void demo() {
    static int count = 0;
    count++;
    printf("%d ", count);
}

int main() {
    demo();
    demo();
    demo();
    return 0;
}


1 1 1

1 2 3

0 1 2

2 3 4

Tags:
Share your thoughts in the comments