summaryrefslogtreecommitdiff
path: root/scope_tutorial/1.c
diff options
context:
space:
mode:
Diffstat (limited to 'scope_tutorial/1.c')
-rw-r--r--scope_tutorial/1.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/scope_tutorial/1.c b/scope_tutorial/1.c
new file mode 100644
index 0000000..fe38a56
--- /dev/null
+++ b/scope_tutorial/1.c
@@ -0,0 +1,43 @@
+#include <stdio.h>
+#include "header.h"
+
+int hello_num(int, int);
+int a = 0;
+int b = 0;
+
+int main(void)
+{
+ int num = 1;
+
+ {
+ int num = 2;
+ }
+
+ auto double result;
+
+// double result2 = product_again(1,2); //results in error if uncommented because this function is specific to the file it was defined in
+ int value = use_another_static_function(7, 3);
+
+ result = product(1,2);
+
+ int newNum = hello_num(1,2);
+
+ printf("Newnum is: %d\na is: %d\tb is %d\n", newNum,a,b);
+
+ printf("result is: %lf\n", result);
+
+ printf("num is: %d\n", num);
+
+ printf("use_another_static_function(7,3) returns: %d\n", value);
+
+ return 0;
+}
+
+
+int hello_num(int a, int b)
+{
+ a++;
+ ++b;
+
+ return a;
+}