Storage Class Extern
#include <stdio.h>
int p(void);
main()
{
extern int cnt;
int k;
cnt = -10;
k = p();
printf("%d\n", k);
++cnt;
k = p();
printf("%d\n", k);
}
int cnt = 0;
int p(void)
{
return ++cnt;
}
Define and initialize cnt as type int, storage class extern.
Declare cnt as extern.
This is program
pg401.c
Previous slide
Next slide
Back to first slide
View graphic version