#include float rectArea(int width, int height) { return width*height; } float triArea(int base, int height) { return base*height/2.0; } typedef struct shape { int width; int height; float (*area)(int,int); } shape; float grabArea(shape *s) { return s->area(s->width,s->height); } int main(int argv, char *argc[]) { shape rectangle={30,40,&rectArea}; shape triangle={30,40,&triArea}; printf("%f\n%f\n",grabArea(&rectangle),grabArea(&triangle)); return 0; }