c - What does it mean to declare variables as static in a function? -


i looking function audio effect, , found 1 written in c.

inside function, variables declared static. confused, thought static means these variables not visibles other files. since declared inside inside function, not visible other files.

what missing ?

static inside function means hold value next time function called.

for example,

int foo() {     static int = 0;     printf("%d\n", i);     i++; }  int main() {     foo(); // prints 0     foo(); // prints 1 } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -