WAP for working of static variable
#include<stdio.h>
#include<conio.h>
void Check();
int main(){
Check();
Check();
Check();
getch();
}
void Check(){
static int c=0;
printf("%d\t",c);
c+=5;
}
WAP to use a simple function
#include<stdio.h>
#include<conio.h>
int fun(void);
main()
{
int x=5;
clrscr();
printf("\n x = %d ",x);
fun();
getch();
}
int fun(void)
{
int x=6;
printf("\n x = %d ",x);
}
No comments:
Post a Comment