Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c static variables

#include<stdio.h>
int fun()
{
  static int count = 0;
  count++;
  return count;
}
  
int main()
{
  printf("%d ", fun()); // prints 1
  printf("%d ", fun()); // prints 2
  return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #static #variables
ADD COMMENT
Topic
Name
6+2 =