+1 vote
9 views
What is a static variable in C-Programming?
in Technology by (190k points)

1 Answer

0 votes

A static local variables retains its value between the function call and the default value is 0. The following function will print 1 2 3 if called thrice.

void f() { 

   static int i; 

   ++i; 

   printf(“%d “,i); 

}

If a global variable is static then its visibility is limited to the same source code.

by (190k points)

Related questions

+1 vote
1 answer 11 views
+1 vote
1 answer 11 views
11 views asked Nov 9, 2020 in Technology by JackTerrance (190k points)
+1 vote
1 answer 25 views
+1 vote
1 answer 10 views
10 views asked Nov 9, 2020 in Technology by JackTerrance (190k points)
+1 vote
1 answer 8 views
8 views asked Nov 9, 2020 in Technology by JackTerrance (190k points)
+1 vote
1 answer 13 views
+1 vote
1 answer 15 views
+1 vote
1 answer 16 views
0 votes
1 answer 13 views
+1 vote
1 answer 15 views
+1 vote
1 answer 13 views
+1 vote
1 answer 14 views
+1 vote
1 answer 11 views
0 votes
1 answer 14 views
14 views asked Nov 9, 2020 in Technology by JackTerrance (190k points)
0 votes
1 answer 11 views
11 views asked Nov 9, 2020 in Technology by JackTerrance (190k points)
0 votes
1 answer 6 views
+1 vote
1 answer 19 views
+1 vote
1 answer 18 views
...