#include #include typedef struct { int num; int den; } fraction_t; void printFraction_v1(fraction_t F) { printf("%2d\n", F.num); printf("--\n"); printf("%2d\n", F.den); printf("\n"); } // This one uses pointers void printFraction_v2(fraction_t* fp) { fp-> num = 5; printf("%2d\n", fp->num); printf("--\n"); printf("%2d\n", fp->den); printf("\n"); } int main() { fraction_t F; F.num=1; // initialize the fraction F to 1/2 F.den=2; fraction_t* p; // pointer to a type fraction_t (which is a struct) // initialize the pointer p = &F; // p points to F (or the memory address where F is stored) // Do the same thing in two different ways printFraction_v1(F); printFraction_v2(p); // this one uses a pointer system("pause"); }