Re: Abnormal program termination




ehabaziz2001@xxxxxxxxx wrote:
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);
}

Repeat after me: "main() returns an int, so we must supply an int for
it to return."

What happens if you /don't/ return an int out of main()?
Well, "Abnormal program termination" is one possible answer.

[snip]

HTH
--
Lew Pitcher

.



Relevant Pages

  • Re: Abnormal program termination
    ... More numbers (y/n)? ... Abnormal program termination ... int no_numbers,i; ... float ave,average; ...
    (comp.lang.c)
  • Re: Abnormal program termination
    ... int value. ... float ave,average; ... the `void' at the beginning says ...
    (comp.lang.c)
  • Abnormal program termination
    ... More numbers (y/n)? ... Abnormal program termination ... int no_numbers,i; ... float ave,average; ...
    (comp.lang.c)
  • Re: algorithm for file shredding
    ... int mainnot int main ... If you give maina return type other than int, in pre-C99 compilers ... behavior if the implementation says so, or undefined behavior if it ... we read about program termination. ...
    (comp.programming)
  • Re: Why this works???
    ... play here. ... Program termination ... int, a return from the initial call to the main function is equivalent ... but not for C89. ...
    (comp.lang.c)