Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
int globalVar = 10; // extern storage class (global variable)
void demoExtern() {
extern int globalVar;
printf("Extern Global Variable = %d\n", globalVar);
}
void demoStatic() {
static int count = 0;
count++;
printf("Static Count = %d\n", count);
}
int main() {
auto int a = 5; // auto (default local variable)
register int r = 10; // register storage class
printf("Auto Variable = %d\n", a);
printf("Register Variable = %d\n", r);
demoExtern();
demoStatic();
demoStatic();
demoStatic();
return 0;
}Coding works best on desktop or with an external keyboard.