static_data_example.c¶
#include <stdio.h>
#include <stdlib.h>
int counter = 0; // global var
int main(int argc, char** argv) {
counter++;
printf("count = %d\n",counter);
return EXIT_SUCCESS;
}
stack_data_example.c¶
#include <stdio.h>
#include <stdlib.h>
int foo(int a) {
int x = a + 1; // local var
return x;
}
int main(int argc, char** argv) {
int y = foo(10); // local var
printf("y = %d\n",y);
return EXIT_SUCCESS;
}