From 919d8325740cc321dd040f2f1c29256754429a1c Mon Sep 17 00:00:00 2001
From: Jieun <yjeka@ajou.ac.kr>
Date: Thu, 13 Aug 2020 01:04:06 +0900
Subject: [PATCH] Add pointer practice

---
 pointer/test5.c |  1 -
 pointer/test6.c | 24 ++++++++++++++++++++++++
 pointer/test7.c | 15 +++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/pointer/test5.c b/pointer/test5.c
index 804a013..6b4ca25 100644
--- a/pointer/test5.c
+++ b/pointer/test5.c
@@ -16,7 +16,6 @@ int main()
     //int (*f)(int);
     int (*f[4])(int) = {f10, f5, f1, f22};
     printf("%d\n", f[2](10));
-    printf("%d\n", f[b%4](10));
     //f = f10; //f= &f10을 해도 똑값다
     //printf("%d\n", f(a));
 
diff --git a/pointer/test6.c b/pointer/test6.c
index e69de29..023c1bd 100644
--- a/pointer/test6.c
+++ b/pointer/test6.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+int f10(int a)
+{	return a+10; }
+int f5(int a)
+{	return a+5; }
+int f1(int a)
+{	return a+1; }
+int f22(int a)
+{	return a+22; }
+
+
+
+int main()
+{
+	double (*f[10])(int const *a, double (*g[10])(double h)); 
+	int (*q)(int, int, double); 
+
+	int a = 200; 
+	int (*ff)(int); 
+	ff = f10; 
+	printf("%d\n", ff(a)); 
+	
+}
diff --git a/pointer/test7.c b/pointer/test7.c
index e69de29..0d5daa0 100644
--- a/pointer/test7.c
+++ b/pointer/test7.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+float f_f() {return 100.0; }
+int f_i() {return 100; }
+
+
+int main()
+{
+	int (*f)(void); 
+	float (*ff)(void); 
+	f = f_i; 
+	printf("%d\n", f()); 
+	ff = f_f; 
+	printf("%f\n", ff()); 
+}
-- 
GitLab