summaryrefslogtreecommitdiffstats
path: root/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'class.c')
-rw-r--r--class.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/class.c b/class.c
new file mode 100644
index 0000000..dda044a
--- /dev/null
+++ b/class.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+
+void printS(char *str)
+{
+ puts(str);
+}
+
+void printF(float *f)
+{
+ printf("%f\n", f);
+}
+
+struct GLFrame
+{
+ int x, y, z;
+ void (*func1)(char *);
+ void (*func2)(struct GLFrame *, int *, int *, int *);
+};
+
+void modPos(struct GLFrame *frame, int *x, int *y, int *z)
+{
+ frame->x = *x;
+ frame->y = *y;
+ frame->z = *z;
+}
+
+struct GLFrame frame = {
+ .x = 5,
+ .y = 6,
+ .z = 7,
+ .func1 = printS,
+ .func2 = modPos
+};
+
+int main(void)
+{
+#if 0
+ float x = 1.0f;
+ printf("x in hex: 0x%016x\n", x);
+#endif
+
+ int x, y, z;
+ x = y = z = 3;
+ /* i want to modify position vector, xyz */
+ frame.func2(&frame, &x, &y, &z);
+
+ printf("x is: %d\ny is: %d\nz is: %d\n", frame.x, frame.y, frame.z);
+
+ puts("Hello");
+
+ return 0;
+}
+