0
why is the output not similar if I type "int num_calls = 1;" instead of "static int num_calls=1;" ?
#include <stdio.h> void say_hello(); int main() { int i; for (i = 0; i < 5; i++) { say_hello(); } return 0; } void say_hello() { static int num_calls = 1; printf("Hello number %d\n", num_calls); num_calls++; }
1 ответ
0
Because it is static variable when you use static infront of it .