diff options
author | Kyle K <kylek389@gmail.com> | 2011-02-05 05:19:27 -0600 |
---|---|---|
committer | Kamil Kaminski <kamilkss@gmail.com> | 2011-02-05 05:19:27 -0600 |
commit | b49853cb048db3bd893080ff8b81e6911add0338 (patch) | |
tree | fb85fa36fc929e6605f3bb4c73d932a668c6c459 /class.c | |
download | sandbox-b49853cb048db3bd893080ff8b81e6911add0338.tar.gz sandbox-b49853cb048db3bd893080ff8b81e6911add0338.tar.bz2 sandbox-b49853cb048db3bd893080ff8b81e6911add0338.zip |
Initial commit
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 53 |
1 files changed, 53 insertions, 0 deletions
@@ -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; +} + |