http://siber.cankaya.edu.tr/OperatingSystems/cfiles/code10.c code10.c
#include <stdio.h>
#define PI 3.14
typedef struct point {
int x;
int y;
} Point;
typedef struct circle {
Point center;
int radius;
} Circle;
double get_area(Circle *c);
int main(int argc, char *argv[])
{
Point p;
p.x = 3;
p.y = 5;
Circle *circle = (Circle *)malloc(sizeof(*circle));
circle->center = p;
circle->radius = 2;
printf("center: (%d, %d), radius: %d)\nArea: %f\n",
circle->center.x,circle->center.y,circle->radius, get_area(circle));
return 0;
}
double get_area(Circle *c)
{
return 2*PI*c->radius;
}