/* ECP: FILEname=fig9_29.c */ /* 1*/ #include "circle.h" /* 2*/ ShapeType * /* 3*/ ReadCircle( void ) /* 4*/ { /* 5*/ ShapeType *S; /* 6*/ if ( S = malloc( sizeof ( ShapeType ) ) ) /* 7*/ { /* 8*/ printf( "Enter radius: " ); /* 9*/ if( scanf( "%lf", &S->Dimension.Radius ) == 1 ) /*10*/ return S; /*11*/ } /*12*/ return NULL; /*13*/ } /*14*/ void /*15*/ WriteCircle( const ShapeType * Shape ) /*16*/ { /*17*/ printf( "radius %.2f", Shape->Dimension.Radius ); /*18*/ } /*19*/ void /*20*/ AreaCircle( ShapeType * Shape ) /*21*/ { /*22*/ Shape->Area = Pi * Shape->Dimension.Radius /*23*/ * Shape->Dimension.Radius; /*24*/ }