Storage classes in cfa
Storage classes in cfa
These
features basically include the scope, visibility and life-time which help
us to trace the existence of a particular variable during the runtime of
a program.
Program:
#include <stdio.h>
int main( )
{
auto int j = 1;
{
auto int j= 2;
{
auto int j = 3;
printf ( "%d ", j);
}
printf ( "%d ",j);
}
printf( "%d", j);
}
Output :
3 2 1
#include <stdio.h>
void display();
int main()
{
display();
display();
}
void display()
{
static int c = 1;
c += 5;
printf("%d ",c);
}
Output:
6 11
#include <stdio.h>
int main( )
{
register int a=25;
printf("%d",a);
return 0;
}
Output:
25
File1.c
#include<stdio.h>
#include "file2.c"
extern int a;
int main()
{
printf("%d",a);
return 0;
}
File2.c
int a =50;
Output:
50