Abnormal program termination
- From: ehabaziz2001@xxxxxxxxx
- Date: 1 Sep 2006 03:48:34 -0700
I am facing that error message with no idea WHY the reason ? "Abnormal
program termination"
E:\programs\c_lang\iti01\tc201\ch06\own> arr01o01
Enter a number : 25
More numbers (y/n)? y
Enter a number : 30
More numbers (y/n)? n
25.000000
30.000000
The average is 27.500000
Abnormal program termination
E:\programs\c_lang\iti01\tc201\ch06\own>type arr01o01.c
/*#include <stdio.h>
/*-exercise 6.1.1 - calculate average of a series of numbers*/
main ()
{
float number[100];
int no_numbers,i;
float ave(),average;
input_nos(&no_numbers,number);
average=ave(no_numbers,number);
print_nos(number,no_numbers,average);
}
input_nos(count,nos)
int *count;
float *nos;
{
char another_no;
*count=0;
do
{
++(*count);
printf("Enter a number : ");
scanf("%f",&nos[*count]);
if (*count<100)
{
printf("More numbers (y/n)? ");
scanf("\n");
scanf("%c",&another_no);
}
}
while (another_no=='y'&&(*count)<100);
}
float ave(n_n,n)
int n_n;
float *n;
{
float total=0;
int i;
for (i=0;i<=n_n;i++)
total=total+n[i];
return(total/n_n);
}
print_nos(nu,n_n,a)
int n_n;
float *nu,a;
{
int i;
for (i=1;i<=n_n;i++)
printf ("%f\n",nu[i]);
printf ("\n The average is %f \n",a);
}
.
- Follow-Ups:
- Re: Abnormal program termination
- From: Richard Heathfield
- Re: Abnormal program termination
- From: Eric Sosman
- Re: Abnormal program termination
- From: Christopher Benson-Manica
- Re: Abnormal program termination
- From: Lew Pitcher
- Re: Abnormal program termination
- From: jacob navia
- Re: Abnormal program termination
- Prev by Date: Re: General method for dynamically allocating memory for a string
- Next by Date: Re: Suggestions for declarations.
- Previous by thread: A function for parsing complex declaration's
- Next by thread: Re: Abnormal program termination
- Index(es):
Relevant Pages
|