Saturday, December 24, 2011

C Program to demonstrate the use of static variables

#include<stdio.h>
#incl.ude<conio.h>
void stat();
void main()
{
    int c;
    clrscr();
     for(c=1;c<=3;c++)
     stat();
     getch();
}

void stat()
{
  static int sv=0;
  sv=sv+1;
  printf("%d\n",sv);
}

No comments:

Post a Comment