Value and type of last evaluated expression: Address of array element: Address of array elementx: (none)
Your browser does not support the canvas element
which will make some the features unavailable.
If you are using Internet Explorer within the University of Exeter
try going to the Settings menu (probably the gear shape at the top right
of this page),
selecting "Compatibility View settings",
unchecking "Display intranet sites in Compatibility View"
and reloading this page.
» float moveby[2], resize;
» Ellipse *e=NULL;
»e=malloc(sizeof *e);
» if (e==NULL) {
»fprintf(stderr, "Out of memory\n");
»exit(99);
}
»printf("Welcome to the ellipse program\n");
»read_ellipse(e);
»printf("The area of the ellipse is: %f\n", e->area);
»printf("Amount to move the ellipse?\n");
»scanf("%g %g", &moveby0, &moveby1);
»move_ellipse(e, moveby);
»printf("Amount to resize the ellipse?\n");
»scanf("%g", &resize);
»resize_ellipse(e, resize);
» return 0;
}
void read_ellipse(Ellipse *el){ ...
»printf("Centre? (x,y)\n");
»scanf("%f %f", &el->centre[0], &el->centre[1]);
»printf("Length of axes ( > 0 )?\n");
»scanf("%f %f", &el->axes[0], &el->axes[1]);
»printf("Orientation to the vertical?\n");
»scanf("%f", &el->orientation);
»calculate_area(el);// Pass the pointer to another function
}
// Resize an ellipse by the same scaling factor in each dimension.
void resize_ellipse(Ellipse *el,float scale){ ...
NB: the actual memory address of each variable is
the address shown plus 4286593048 (0xFF803818).
The actual address of allocated memory is
the address shown plus 159261272 (0x97E2258).
Show Advanced options
.
Input was:
7.2 4.5 1.2 4.3 1.7
1.1 2.2 3.8
Show output
(Before looking at the output,
work out what you think it put should be and see if you are right.)
Output
Welcome to the ellipse program
Centre? (x,y)
Length of axes ( > 0 )?
Orientation to the vertical?
The area of the ellipse is: 16.210619
Amount to move the ellipse?
Amount to resize the ellipse?