this program im writing should take radius imputs from the user after the user selects how many circles (between 1 and 10) they would like to imput radi for. after that, it should store those radi in an array, and calculate circumference and area for each radi and print the results.
what i have so far compiles just fine however when i run the ./a file (im using cygwin) i get an error of the following:
18 [main] a 2604 _cygtls::handle_exeptions: Error while dumping state (progably corrupted stack)
Segmentation fault (core dumped)
whats goin on with the stack? how can it just corrupt like that...is it a problem whithin my program or my compiler?
Code:#include <stdio.h> #define PI 3.14159265 int main (void) { int circleno, i; int j; float radius[i]; float circumference[i]; float area[i]; circleno = i; printf("Please enter the number of circles (max = 10):\n"); scanf("%i", &circleno); if ( circleno > 10 ) printf("Error -> %i circles is to many. Please try again:\n", circleno ); else for ( j = 1; j <= circleno; ++j ) { printf("Enter the radius for circle #%i:\n", j); scanf("%f", &radius[i]); } circumference[i] = 2*PI*radius[i]; area[i] = PI*radius[i]*radius[i]; printf("radi = %f\n", radius[i]); printf("circumferences = %f\n", circumference[i]); printf("areas = %f\n", area[i]); }