Answers for "c static variables"

C
1

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;
}
Posted by: Guest on April-06-2022

Code answers related to "C"

Browse Popular Code Answers by Language