Created
March 29, 2011 01:45
-
-
Save zrbecker/891678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef struct simple_s { | |
int x; | |
int y; | |
} *simple_p, simple; | |
typedef struct fancy_s { | |
simple s; | |
int dx; | |
int dy; | |
} *fancy_p, fancy; | |
void print_simple(simple_p s) | |
{ | |
printf("Printing Simple\n"); | |
printf("x: %d, y: %d\n", s->x, s->y); | |
} | |
void print_fancy(fancy_p f) | |
{ | |
printf("Printing Fancy\n"); | |
printf("x: %d, y: %d\n", f->s.x, f->s.y); | |
printf("dx: %d, dy: %d\n", f->dx, f->dy); | |
} | |
int main() | |
{ | |
fancy f = { 100, 100, 10, -7 }; | |
print_fancy(&f); | |
printf("\n"); | |
print_simple((simple_p) &f); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment